View Code of Problem 104

#include <iostream>
#include <math.h>
#include <string>
using namespace std;

int main() {
	int n, v1, v2, t;
	while (cin >> n >> v1 >> v2 >> t) {
		if (v1 <= v2) {
			cout << "NO" << endl;
			continue;
		}
		double t1 = n * 1000 * 1.0 / (v1 - v2); // v1*t >= n*1000+v2*t
		if (t1 >= t) cout << "NO" << endl;
		else  printf("%.2lf\n", t1);
 
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 104