#include<iostream> #include<vector> #include<algorithm> #include<string> #include<climits> #include<cmath> #include<unordered_map> #include<set> using namespace std; int main() { int n, v1, v2, t; while (cin >> n >> v1 >> v2 >> t) { n = n * 1000; if (v1 <= v2) { cout << "NO" << endl; continue; } double sub = v1 - v2; //速度差 double time = (double)(n / sub); //sub不能为0 if (time <= t) printf("%.2lf\n", time); else cout << "NO" << endl; } } |
Double click to view unformatted code.