View Code of Problem 104

#include<bits/stdc++.h>
using namespace std;

int main() {

	double n, v1, v2, t;
	while(cin>>n>>v1>>v2>>t){
		int flag=0;
		double time;
		if(v1<=v2){
			flag=1;
		}else{
			time=(double)(n*1000/(v1-v2));
			if(time>t){
				flag=1;
			}
		}
		if(flag==1){
			cout<<"NO"<<endl;
		}else{
			printf("%.2lf\n",time);
		}
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 104