Skip to content

Instantly share code, notes, and snippets.

@Se7soz
Created January 10, 2013 12:34
Show Gist options
  • Save Se7soz/4501758 to your computer and use it in GitHub Desktop.
Save Se7soz/4501758 to your computer and use it in GitHub Desktop.
#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