Advertisement
misteraverin

Untitled

Nov 26th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cstdio>
  4. #include <cstdlib>
  5. #include <string>
  6. #include <algorithm>
  7. #include <cassert>
  8. #include <cmath>
  9. #include <utility>
  10. #include <map>
  11. #include <set>
  12. #include <vector>
  13. #include <conio.h>
  14.  
  15. using namespace std;
  16.  
  17. double x11, y11, xc, yc, x2, y2, h, dh, a, t;
  18.  
  19. double f(double x)
  20. {
  21.     return 2 * (a - x) * (x*dh / a + h);
  22. }
  23.  
  24. int main()
  25. {
  26.    
  27.     scanf("%lf%lf%lf%lf%lf%lf", &xc, &yc, &x11, &y11, &x2, &y2);
  28.     if (y2 >= yc)
  29.     {
  30.         printf("0");
  31.         return 0;
  32.     }
  33.  
  34.     if (x11 > x2)
  35.     {
  36.         x11 = t;
  37.         x11 = x2;
  38.         x2 = t;
  39.     }
  40.  
  41.     if (y11 < y2)
  42.     {
  43.         y11 = t;
  44.         y11 = y2;
  45.         y2 = t;
  46.     }
  47.  
  48.     a = xc - x11;
  49.     h = y11;
  50.     dh = yc - y11;
  51.  
  52.     if (dh - h > 0)
  53.         printf("%lf", f(a*(dh - h) / (dh*2.0)));
  54.     else
  55.         printf("%lf", f(0));
  56.  
  57.     _getch();
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement