标签:
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 678 Accepted Submission(s): 238
1 /************************************************************************* 2 > File Name: code/hdu/3552.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: 2015年11月09日 星期一 10时20分55秒 6 ************************************************************************/ 7 8 #include<iostream> 9 #include<iomanip> 10 #include<cstdio> 11 #include<algorithm> 12 #include<cmath> 13 #include<cstring> 14 #include<string> 15 #include<map> 16 #include<set> 17 #include<queue> 18 #include<vector> 19 #include<stack> 20 #include<cctype> 21 #define fst first 22 #define sec second 23 #define lson l,m,rt<<1 24 #define rson m+1,r,rt<<1|1 25 #define ms(a,x) memset(a,x,sizeof(a)) 26 using namespace std; 27 const double eps = 1E-8; 28 const int dx4[4]={1,0,0,-1}; 29 const int dy4[4]={0,-1,1,0}; 30 typedef long long LL; 31 const int inf = 0x3f3f3f3f; 32 const double pi = acos(-1.0); 33 const int N=1E3+7; 34 int n; 35 double ang[N]; 36 int dblcmp( double d) 37 { 38 return d<-eps?-1:d>eps; 39 } 40 struct point 41 { 42 double x,y; 43 point(){} 44 point (double _x,double _y): 45 x(_x),y(_y){}; 46 47 void input() 48 { 49 scanf("%lf %lf",&x,&y); 50 } 51 52 double myatan2(point p) 53 { 54 double res = atan2(p.y-y,p.x-x); 55 return res>0?res:res+2*pi; 56 } 57 }p[N]; 58 59 int main() 60 { 61 #ifndef ONLINE_JUDGE 62 freopen("in.txt","r",stdin); 63 #endif 64 65 while (scanf("%d",&n)!=EOF) 66 { 67 if (n<=0) break; 68 for ( int i = 0 ; i < n ; i++) p[i].input(); 69 70 double mx = 0; 71 for ( int i = 0 ; i < n ; i++ ) 72 { 73 int cnt = 0 ; 74 for ( int j = 0 ; j < n ;j++) 75 { 76 if (i==j) continue; 77 ang[cnt++] = p[i].myatan2(p[j]); 78 } 79 sort(ang,ang+cnt); 80 double mn = 999999; 81 for ( int j = 0 ; j < cnt-1 ; j++) 82 { 83 double tmp = ang[j+1]-ang[j]; 84 if (dblcmp(tmp-pi)>0) //直线的夹角不可能是钝角 85 { 86 tmp = 2*pi-tmp; 87 } 88 mn = min(tmp,mn); 89 } 90 mx = max(mn,mx); 91 } 92 printf("%.4f\n",mx*(180.0/pi)); 93 94 } 95 96 97 #ifndef ONLINE_JUDGE 98 #endif 99 fclose(stdin); 100 return 0; 101 }
标签:
原文地址:http://www.cnblogs.com/111qqz/p/4949392.html