View Code of Problem 104

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
	double n, v1, v2, t;
	while(~scanf("%lf%lf%lf%lf", &n, &v1, &v2, &t)){
		int flag = 1;
		double m = n*1000/(v1-v2);
		if(v1<v2) flag = 0;
		if(m>t) flag = 0;
		if(flag) printf("%.2lf\n", m);
		else printf("NO\n");
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 104