标签:hdu
3 5.0 4.0 3.1 0.1 2.0 2.0 -1
3.1 0.1 5.0 4.0 2.0 2.0
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct node{
double x,y,t;
}s[10010];
int cmp(node a,node b)
{
return a.t<b.t;
}
int main()
{
int n,i;
while(~scanf("%d",&n),n>=0)
{
for(i=0;i<n;i++)
{
scanf("%lf%lf",&s[i].x,&s[i].y);
s[i].t=atan2(s[i].y,s[i].x);
}
sort(s,s+n,cmp);
printf("%.1lf %.1lf",s[0].x,s[0].y);
for(i=1;i<n;i++)
{
printf(" %.1lf %.1lf",s[i].x,s[i].y);
}
printf("\n");
}
return 0;
} hdu 1785(You Are All Excellent)(数学函数atan2(y.x)返回(x,y)的反正切值)
标签:hdu
原文地址:http://blog.csdn.net/ice_alone/article/details/40189677