Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. #include <cstdio>
  5. using namespace std;
  6. const double PI = 3.14159265358979323846;
  7. const double eps = 10e-9;
  8. struct pt
  9. {
  10. double x, y;
  11. pt(double x = 0, double y = 0) : x(x), y(y) {}
  12. };
  13. double polar_angle(pt a) {
  14. double d = atan2(a.y, a.x);
  15. if (d < -eps) d += 2 * PI;
  16. return d;
  17. }
  18.  
  19. int main() {
  20. ios_base::sync_with_stdio(false);
  21. freopen("angle1.in", "r", stdin);
  22. freopen("angle1.out", "w", stdout);
  23. int x, y;
  24. cin >> x >> y;
  25. pt a(x, y);
  26. cout << setprecision(9) << polar_angle(a);
  27. }
  28.  
  29. /* Tue Mar 13 2018 19:57:31 GMT+0300 (MSK) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement