Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- #include <cstdio>
- using namespace std;
- const double PI = 3.14159265358979323846;
- const double eps = 10e-9;
- struct pt
- {
- double x, y;
- pt(double x = 0, double y = 0) : x(x), y(y) {}
- };
- double polar_angle(pt a) {
- double d = atan2(a.y, a.x);
- if (d < -eps) d += 2 * PI;
- return d;
- }
- int main() {
- ios_base::sync_with_stdio(false);
- freopen("angle1.in", "r", stdin);
- freopen("angle1.out", "w", stdout);
- int x, y;
- cin >> x >> y;
- pt a(x, y);
- cout << setprecision(9) << polar_angle(a);
- }
- /* Tue Mar 13 2018 19:57:31 GMT+0300 (MSK) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement