Created
January 10, 2013 12:34
-
-
Save Se7soz/4501758 to your computer and use it in GitHub Desktop.
Solution for http://www.codeforces.com/contest/257/problem/C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cmath> | |
#include<algorithm> | |
#include<vector> | |
#include<cstdio> | |
using namespace std; | |
int main() { | |
int n; | |
cin >> n; | |
vector<double> angles; | |
int i, x, y; | |
for(i = 0; i < n; i++) { | |
cin >> x >> y; | |
angles.push_back(atan2(y, x)); | |
} | |
sort(angles.begin(), angles.end()); | |
double mx_diff = 0; | |
for(i = 0; i < n-1; i++) | |
mx_diff = max(mx_diff, angles[i+1]-angles[i]); | |
double diff = angles[0]-angles[n-1]; | |
if(diff < 1e-7) diff += 360*M_PI/180; | |
mx_diff = max(mx_diff, diff); | |
printf("%.10lf\n", 360-(mx_diff*180/M_PI)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment