HDU-2007 Scrambled Polygon 极角排序
来源:互联网 发布:电子病历系统源码 编辑:程序博客网 时间:2024/06/05 15:34
题目地址
题意:就是将所给点按凸包顺序输出,从原点开始。
分析:其实就是将除原点外的点进行极角排序。
#include<stdio.h>#include<algorithm>#include<math.h>using namespace std;const int maxn = 55;int n,r;struct Point{double x,y;Point( double x = 0,double y = 0 ): x(x),y(y) { }}point[maxn],ch[maxn];double Cross( Point A,Point B,Point C ){ return ( A.x - C.x ) * ( B.y - C.y ) - ( B.x - C.x ) * ( A.y - C.y );}bool cmp( Point A,Point B ){ return Cross( A,B,point[0] ) >= 0;}int main(){ n = 0;while( scanf("%lf%lf",&point[n].x,&point[n].y) != EOF ){ n ++; } sort( point+1,point+n,cmp ); for( int i = 0; i < n; i ++ ) printf("(%.0lf,%.0lf)\n",point[i].x,point[i].y);return 0;}
0 0
- HDU-2007 Scrambled Polygon 极角排序
- poj 2007 Scrambled Polygon 极角排序
- POJ 2007 Scrambled Polygon(极角排序)
- POJ 2007 Scrambled Polygon 极角排序
- poj 2007 Scrambled Polygon [极角排序]
- POJ 2007 Scrambled Polygon 极角排序
- PKU 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 (极角排序+叉乘)
- Scrambled Polygon (极角排序)
- poj2007 Scrambled Polygon【极角排序】
- poj2007-Scrambled Polygon (极角排序)
- linux 下启动级别命令
- HDU 4507 吉哥系列故事——恨7不成妻(数位DP)
- Confluence 4.0 功能亮点
- 百度开源项目聚合,百度开源平台
- struts中Action类的国际化
- HDU-2007 Scrambled Polygon 极角排序
- 使用TDBChart显示InterBase数据库的一行数据
- 七牛云存储,不再为网站空间担心
- TNS-12535:TNS:操作超时
- ZOJ-1949
- __thread 和 __typeof__关键字
- 图像腐蚀
- 基于OpenCV的读取摄像头实现单个人脸验证MFC程序
- 复制数据结构 - 单链表及图