artemgf

Комфорт пассажиров

Nov 12th, 2017
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #define _USE_MATH_DEFINES
  2. #include <iostream>
  3. #include <string>
  4. #include <map>
  5. #include <set>
  6. #include <algorithm>
  7. #include <vector>
  8. #include <stdio.h>
  9. #include <cmath>
  10. #include <math.h>
  11. #include <queue>
  12. #include <stack>
  13. #include <climits>
  14. #include <deque>
  15. #include <ctime>
  16.  
  17. using namespace std;
  18.  
  19. typedef long long ll;
  20. typedef unsigned long long ull;
  21. typedef unsigned int ui;
  22.  
  23. int main()
  24. {
  25.     ll h, t, v, x;
  26.     cin >> h >> t >> v >> x;
  27.  
  28.     cout.precision(6);
  29.     cout.setf(ios::fixed);
  30.  
  31.     double min = DBL_MAX, max = -1;
  32.     double f = x - v;
  33.     double s = h - v*t;
  34.     double T = t;
  35.     double Min = T - (s / f);
  36.     if (Min >= 0)
  37.         min = Min;
  38.     else
  39.         min = 0;
  40.  
  41.     if (h / (t*1.0) > x)
  42.         max = t*1.0;
  43.     else
  44.         max = h / (x*1.0);
  45.     cout << min << " " << max << endl;
  46.     system("pause");
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment