poj 2007 Scrambled Polygon
来源:互联网 发布:p2p网络金融 编辑:程序博客网 时间:2024/06/05 10:48
#include <cstdio>
#include <algorithm>
#include <cmath>
struct P{
int x;
int y;
double slope;
} point[100];
P stack[100];
int main()
{
scanf("%d%d",&point[0].x,&point[0].y);
int count=1;
int top=3;
while (scanf("%d%d",&point[count].x,&point[count].y) != EOF)
{
if (point[count].x==0 && point[count].y==0) continue;
point[count].slope=atan2(double(point[count].y),double(point[count].x));
count++;
}
for (int i=1;i<count;i++)
for (int j=i+1;j<count;j++)
{
if (((point[i].x*point[j].y)-(point[j].x*point[i].y)) < 0)
{
P t=point[i];
point[i]=point[j];
point[j]=t;
}
}
stack[0]=point[0];
stack[1]=point[1];
stack[2]=point[2];
for (int i=3;i<count;i++)
{
while (top)
{
P p1=stack[top-1];
P p2=stack[top-2];
int x1=p1.x-p2.x,y1=p1.y-p2.y;
int x2=point[i].x-p2.x,y2=point[i].y-p2.y;
if ( (x1*y2-x2*y1) < 0)
top--;
else break;
}
stack[top++]=point[i];
}
for (int i=0;i<top;i++)
printf("(%d,%d)/n",stack[i].x,stack[i].y);
return 0;
}
- poj 2007 Scrambled Polygon
- poj 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- poj 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon .
- POJ 2007 Scrambled Polygon
- poj 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon(几何)
- POJ 2007 Scrambled Polygon 笔记
- zoj 2352 || poj 2007 Scrambled Polygon
- poj 2007 Scrambled Polygon--按极角排序
- poj 2007 Scrambled Polygon 极角排序
- POJ 2007 Scrambled Polygon(极角排序)
- POJ 2007 Scrambled Polygon(凸包)
- CSDN总编观察:拥抱十万亿移动大变革——《程序员》2010年第9期卷首语
- poj 1204 Word Puzzles
- Google Docs(8.26-2)
- poj 1324 Holedox Moving
- POJ_3356_AGTC
- poj 2007 Scrambled Polygon
- SSH项目和XFire(WebService)整合 好后测试时抱一下错误............由于本人刚上手,属菜鸟.........敬请各路神仙给予指点.........
- 万恶的android API
- poj 3020 Antenna Placement
- 7.2 下半部和推后执行的工作_tasklet
- 推荐iPhone和Android开发必备的几本中文书
- POJ_3510_A Tale from the Dark Side of the Moon
- UNIX系统编程 第2章 程序、进程和线程
- 电脑故障排除经验