drof13

Untitled

Mar 23rd, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.05 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iostream>
  4. #include <iterator>
  5. #include <map>
  6. #include <set>
  7. #include <string>
  8. #include <vector>
  9. #include <algorithm>
  10. #include <stack>
  11. #include <deque>
  12. #include <queue>
  13. #include <climits>
  14.  
  15. #define int long long
  16. #define db double
  17. #define ff first
  18. #define ss second
  19.  
  20. using namespace std;
  21.  
  22. const int MOD = 1e9 + 7;
  23. // const int INF = LONG_MAX;
  24. const int INF = INT_MAX;
  25. const int MAXW = 10001;
  26. const double PI = 3.14159265358979323846;
  27.  
  28. struct Point {
  29.     int x;
  30.     int y;
  31.  
  32.     Point& operator += (const Point& p) {
  33.         x += p.x;
  34.         y += p.y;
  35.         return *this;
  36.     }
  37.  
  38.     Point& operator -= (const Point& p) {
  39.         x -= p.x;
  40.         y -= p.y;
  41.         return *this;
  42.     }
  43. };
  44.  
  45. ostream& operator << (ostream& out, Point& p) {
  46.     out << p.x << " " << p.y << '\n';
  47.     return out;
  48. }
  49.  
  50. istream& operator >> (istream& in, Point& p) {
  51.     in >> p.x >> p.y;
  52.     return in;
  53. }
  54.  
  55. struct Vct {
  56.     int x;
  57.     int y;
  58.  
  59.     Vct& operator += (const Vct& a) {
  60.         x += a.x;
  61.         y += a.y;
  62.         return *this;
  63.     }
  64.  
  65.     Vct& operator -= (const Vct& a) {
  66.         x -= a.x;
  67.         y -= a.y;
  68.         return *this;
  69.     }
  70.  
  71.     Vct& operator *= (const int c) {
  72.         x *= c;
  73.         y *= c;
  74.         return *this;
  75.     }
  76. };
  77.  
  78. Vct operator + (const Vct& a, const Vct& b) {
  79.     Vct tmp = a;
  80.     tmp += b;
  81.     return tmp;
  82. }
  83.  
  84. Vct operator - (const Vct& a, const Vct& b) {
  85.     Vct tmp = a;
  86.     tmp -= b;
  87.     return tmp;
  88. }
  89.  
  90. ostream& operator << (ostream& out, Vct& v) {
  91.     out << v.x << " " << v.y << '\n';
  92.     return out;
  93. }
  94.  
  95. istream& operator >> (istream& in, Vct& v) {
  96.     in >> v.x >> v.y;
  97.     return in;
  98. }
  99.  
  100. signed main() {
  101.     ios_base::sync_with_stdio(0);
  102.     cin.tie(0);
  103.     cout.tie(0);
  104.     Vct f, s;
  105.     cin >> f >> s;
  106.     double ans = abs(atan2(f.y, f.x) - atan2(s.y, s.x));
  107.     if (ans > PI) {
  108.         ans -= PI;
  109.     }
  110.     if (abs(2 * PI - ans) < ans) {
  111.         ans = abs(2 * PI - ans);
  112.     }
  113.     cout.precision(20);
  114.     cout << fixed << ans;
  115. }
Advertisement
Add Comment
Please, Sign In to add comment