View Code of Problem 104

#include <stdio.h>
#include <stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>

int main()
{
	float v1, v2, n, t, s;
	while (scanf("%f%f%f%f",&n,&v1,&v2,&t)!=EOF)
	{
		 if (v1 > v2)
		{
			if (v1*t - v2 * t >= n * 1000)
			{
				s = n * 1000.0 / (v1 - v2);
				printf("%.2f\n", s);
			}
			else printf("NO\n");
		}else printf("NO\n");


	}
	return 0;
}

Double click to view unformatted code.


Back to problem 104