View Code of Problem 104

#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){
    double n,v1,v2,t,v;
    while(cin>>n>>v1>>v2>>t){
        n=n*1000;
        v=0;
        if(v2>v1)
            cout<<"NO"<<endl;
        else{
            v=abs(v2-v1);
            if(n/v<=t)
                cout<<fixed<<setprecision(2)<<n/v<<endl;
            else
                cout<<"NO"<<endl;
        }
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 104