Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <string>
- #include <algorithm>
- #include <cassert>
- #include <cmath>
- #include <utility>
- #include <map>
- #include <set>
- #include <vector>
- #include <conio.h>
- using namespace std;
- double x11, y11, xc, yc, x2, y2, h, dh, a, t;
- double f(double x)
- {
- return 2 * (a - x) * (x*dh / a + h);
- }
- int main()
- {
- scanf("%lf%lf%lf%lf%lf%lf", &xc, &yc, &x11, &y11, &x2, &y2);
- if (y2 >= yc)
- {
- printf("0");
- return 0;
- }
- if (x11 > x2)
- {
- x11 = t;
- x11 = x2;
- x2 = t;
- }
- if (y11 < y2)
- {
- y11 = t;
- y11 = y2;
- y2 = t;
- }
- a = xc - x11;
- h = y11;
- dh = yc - y11;
- if (dh - h > 0)
- printf("%lf", f(a*(dh - h) / (dh*2.0)));
- else
- printf("%lf", f(0));
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement