Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- using namespace std;
- double Equal(double a, double b)
- {
- return abs(a - b) < 10e-7;
- }
- bool Bigger(double a, double b)
- {
- return !Equal(a, b) && a > b;
- }
- int main()
- {
- //freopen("Text.txt", "r", stdin);
- double h, t, v, x;
- scanf("%lf%lf%lf%lf", &h, &t, &v, &x);
- double minT;
- if (Bigger(x * t, h) || Equal(x * t, h))
- minT = 0;
- else
- minT = (double)(h - x * t) / (v - x);
- double maxT;
- if (Bigger(h, x * t) || Equal(h, x * t))
- maxT = t;
- else
- maxT = (double)h / x;
- printf("%.10lf %lf", minT, maxT);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement