View Code of Problem 104

#include<stdio.h>
int main()
{
	int n,v1,v2;
	float t;
	while(scanf("%d %d %d %d",&n,&v1,&v2,&t)!=EOF)
	{
		n=n*1000;
		if(v2>=v1)
			printf("NO\n");
		else
		{
			if(v1*t>v2*t+n)
			{
				t=n*1.0/(v1-v2);
				printf("%.2f\n",t);
			}
			else printf("NO\n");
		}
	}
}

Double click to view unformatted code.


Back to problem 104