poj2007 Scrambled Polygon
极角排序
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct point
{
double x;
double y;
}a[55];
double mu(point a,point b)
{
return a.x*b.y-b.x*a.y;
}
bool cmp(const point &a,const point &b)
{
return mu(a,b)>0;
}
int main()
{
int k=0;
while(scanf("%lf %lf",&a[k].x,&a[k].y)!=EOF)
{
k++;
}
printf("(0,0)\n");
sort(a+1,a+k,cmp);
int i;
for(i=1;i<k;i++)
{
printf("(%.0f,%.0f)\n",a[i].x,a[i].y);
}
return 0;
}