View Code of Problem 104

#include<iostream>
#include<iomanip>

using namespace std;

int main() {
	double n, v1, v2, t;
	double time;
	while (cin >> n >> v1 >> v2 >> t) {
		if (v1 <= v2) {
			cout << "NO" << endl;
		}
		else {
			time = 1000 * n / (v1 - v2);
			if (time <= t) {
				cout << fixed << setprecision(2) << time << endl;
			}
			else {
				cout << "NO" << endl;
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 104