View Code of Problem 104

#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
	double n,v1,v2,t;
	while(cin>>n>>v1>>v2>>t){
		double k=0;
		if(v1<=v2)cout<<"NO"<<endl;
		else {
			k=n*1000/(v1-v2);
			if(k<=t)printf("%.2f\n",k);
			else cout<<"NO"<<endl;
			
		}
//else if(v1<0&&v2<0){
//			k=n*1000/(v1-v2);
//		if(k<=t)printf("%.2f",k);
//			else cout<<"NO"<<endl;
//		}
		
		
	} 
	return 0;
}

Double click to view unformatted code.


Back to problem 104