View Code of Problem 104

#include <stdio.h>
int main()
{
	double n,v1,v2,t,v,t1;
	while(scanf("%lf%lf%lf%lf",&n,&v1,&v2,&t)!=EOF)
	{
		if(v1<=v2)
		{
			printf("NO\n");  //b车本来就在a车的前面 如果a车的速度比b车小的话肯定无法相遇
		}
		else
		{
			v=v1-v2;     
			t1=n*1000/v;
			if(t1<=t)
			{
				printf("%0.2lf\n",t1);
			}
			else
				printf("NO\n");
		}
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 104