View Code of Problem 104

#include<stdio.h>
int main(){
int a,b,v1,v2,n,t;
int p1,p2;
float time;
while(scanf("%d%d%d%d",&n,&v1,&v2,&t)!=EOF)
{  n=1000*n;
   p1=v1*t;
   p2=v2*t+n;
  if(p1>=p2){
  time=n/(v1-v2)*1.0;
    if(time<=t)
  {printf("%.2f\n",time);}
    else{ printf("NO\n");}
  }
  else{
   printf("NO\n");
  }
}
}

Double click to view unformatted code.


Back to problem 104