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