View Code of Problem 104

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
int main()
{
	int n, v1, v2, t;
	float time;
	while (cin >> n >> v1 >> v2>>t) {
		int v = v1 - v2;
		if ((n * 1000 / v > t)||(v <= 0)) {
			cout << "NO"<<endl;
		}
		else {
			time = n * 1000.0 / v;
			cout <<fixed<<setprecision(2) <<time << endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 104