View Code of Problem 104

#include "stdio.h"
#include "math.h"
#include "string.h"

void main()
{
	int i,j,k;
	int a,b;
	int n,v1,v2,t;
	double x;
	for(;scanf("%d%d%d%d",&n,&v1,&v2,&t)!=EOF;)
	{	
		if(v1==v2)
			printf("NO\n");
		else if((v1-v2)*t<n*1000)
			printf("NO\n");
		else
		{
			x=(n*1000)/((v1-v2)*1.00);
			printf("%.2lf\n",x);
		}
	}
}

Double click to view unformatted code.


Back to problem 104