#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int n,v1,v2,t; while(scanf("%d %d %d %d",&n,&v1,&v2,&t)!=EOF){ double time; if(v1<v2){ printf("NO\n"); } else{ time=n*1000.0/(v1-v2); if(time>t){ printf("NO\n"); } else{ printf("%.2lf\n",time); } } } } |
Double click to view unformatted code.