View Code of Problem 104

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

Double click to view unformatted code.


Back to problem 104