Advertisement
artemgf

Марсианские спутники

Nov 15th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 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. #define mh() make_heap()
  24. #define poph() pop_heap()
  25. #define pushh() push_heap()
  26. #define sor(n) n.begin(), n.end()
  27. #define mp make_pair
  28.  
  29. ll Round(double k)
  30. {
  31.     if (ll(k*10)%10 < 0.5)
  32.         return int(k) + 1;
  33.     else
  34.         return int(k);
  35. }
  36. int main()
  37. {
  38.     double a, b, e, d;
  39.     cin >> a >> b >> d >> e;
  40.     double answ;
  41.     if (abs(a*b - d*e) < 1e-9)
  42.         cout << "Impossible.";
  43.     else
  44.     {
  45.         answ = sqrt(d*d + e*e - d*e*((a*a + b*b - d*d - e*e) / (a*b - d*e)));
  46.         answ *= 1000;
  47.         printf("Distance is %.0f km.", answ);
  48.     }
  49.    
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement