#include<stdio.h> #include<malloc.h> #include<string.h> #include<math.h> int main() { int n, v1, v2, t; while (scanf("%d%d%d%d", &n, &v1, &v2, &t) != EOF) { if ((n * 1000 - t * (v1 - v2)) > 0) printf("NO\n"); else { float meet; meet = (float)n * 1000 / (float)(v1 - v2); printf("%.2f\n", meet); } } } |
Double click to view unformatted code.