Advertisement
tumaryui

Untitled

Nov 22nd, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. double M_PI = acos(-1);
  3. struct point
  4. {
  5. double x, y;
  6. };
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int N;
  12. cin >> N;
  13.  
  14. vector<double> out;
  15.  
  16.  
  17.  
  18. point mas[3];
  19. long double alpha, beta;
  20. for (int j = 0; j < N; j++)
  21. {
  22. for (int i = 0; i < 3; i++)
  23. {
  24. std::cin >> mas[i].x >> mas[i].y;
  25. }
  26.  
  27. mas[1].x = mas[1].x - mas[0].x;
  28. mas[1].y = mas[1].y - mas[0].y;
  29. mas[2].x = mas[2].x - mas[0].x;
  30. mas[2].y = mas[2].y - mas[0].y;
  31.  
  32. if (mas[1].y < 0) alpha = 2*M_PI + atan2l(mas[1].y, mas[1].x);
  33. else alpha = atan2l(mas[1].y, mas[1].x);
  34.  
  35. if (mas[2].y < 0) beta = 2 * M_PI + atan2l(mas[2].y, mas[2].x);
  36. else beta = atan2l(mas[2].y, mas[2].x);
  37.  
  38. //std::cout << '\n' << alpha << ' ' << beta << '\n';
  39.  
  40. out.push_back(abs(alpha - beta));
  41. }
  42.  
  43. cout << fixed;
  44. cout.precision(12);
  45. for (int i = 0; i < out.size(); i++)
  46. {
  47. cout << out[i] << '\n';
  48. }
  49.  
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement