View Code of Problem 104

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

Double click to view unformatted code.


Back to problem 104