View Code of Problem 104

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

Double click to view unformatted code.


Back to problem 104