POJ 2007 极角排序
来源:互联网 发布:上海华腾软件公司地址 编辑:程序博客网 时间:2024/05/21 09:00
题意:给出一个凸包的顶点,以第一次输入进去的点按逆时针方向排序。
看到有人说是凸包题,题意已经明确是凸包的顶点所以没有必要再用Graham模板。利用叉积的性质对极角进行排序就可以。
#include <iostream>#include<cstdio>#include<algorithm>using namespace std;struct point{ int x,y;};int Direction(point a,point b,point c){ return (b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y);}point t,data[51];bool cmp(point a,point b){ if(Direction(t,a,b)>=0) return 1; return 0;}int main(){ int n=0,x,y; while(~scanf("%d%d",&x,&y)) data[n].x=x,data[n].y=y,++n; t.x=data[0].x,t.y=data[0].y; sort(data+1,data+n,cmp); for(int i=0; i<n; i++) printf("(%d,%d)\n",data[i].x,data[i].y); return 0;}
- poj 2007(极角排序)
- POJ 2007 极角排序
- poj 2007 极角排序
- poj 2007 极角排序
- POJ 2007 极角排序
- POJ 2007 极角排序
- poj 2007 Scrambled Polygon 极角排序
- POJ 2007 Scrambled Polygon(极角排序)
- POJ 2007 Scrambled Polygon 极角排序
- POJ 2007 (极角排序)
- POJ 2007 (极角排序)
- poj 2007 Scrambled Polygon [极角排序]
- POJ 2007 Scrambled Polygon 极角排序
- poj 2007 Scrambled Polygon 【极角排序】
- POJ 2007 Scrambled Polygon(极角排序)
- poj 2007 凸包 极角排序
- POJ 2007 Scrambled Polygon (极角排序)
- poj 1696 极角排序
- 以太网物理层协议整理(3)-万兆以太网信号映射到OTN的方式
- What things you can do in System Center SM? (Private Cloud)
- U大师U盘装系统——安装Ghost版WIN8系统(V1.1.0版)
- make_pair函数
- 使用数组实现双端队列
- POJ 2007 极角排序
- 如何快速开发手机应用?
- 一个百思不得其解的“ASP.NET 2.0网站运行提示: HTTP 错误 401.3 - 未经授权:访问由于 ACL 对所请求资源的设置被拒绝。 ”错误
- style cursor 鼠标样式
- overcommit_memory
- asp.net给checkBox添加一个绑定属性,后台可以获取
- struts2拦截器如何返回json数据?如何使用Jquery(ExtJs)接收拦截器返回的数据?
- 普通用户执行需要root权限的命令的方法
- 独特的deadlock(仅update语句也能造成死锁)