daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 55 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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) */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top