题目链接

题意 : 对输入的点极角排序

思路 : 极角排序方法

#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm> using namespace std; struct point
{
double x,y;
}p[],pp;
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)
{
int cr = cross(a,b,pp) ;//判断顺时针还是逆时针
if(cr > ) return true ;
else if(cr < ) return false ;
}
int main()
{
int cnt = ;
while (scanf("%lf %lf",&p[cnt].x,&p[cnt].y) != EOF)
{
++cnt;
}
pp.x = pp.y = ;
sort(p+,p+cnt,cmp);
for (int i = ; i < cnt ; i++)
{
cout<<"("<<p[i].x<<","<<p[i].y<<")"<<endl;
}
return ;
}

POJ 2007 Scrambled Polygon (简单极角排序)的更多相关文章

  1. POJ 2007 Scrambled Polygon [凸包 极角排序]

    Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8636   Accepted: 4105 ...

  2. poj 2007 Scrambled Polygon(极角排序)

    http://poj.org/problem?id=2007 Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6701   A ...

  3. POJ 2007 Scrambled Polygon 凸包点排序逆时针输出

    题意:如题 用Graham,直接就能得到逆时针的凸包,找到原点输出就行了,赤果果的水题- 代码: /* * Author: illuz <iilluzen[at]gmail.com> * ...

  4. POJ 2007 Scrambled Polygon(简单极角排序)

    水题,根本不用凸包,就是一简单的极角排序. 叉乘<0,逆时针. #include <iostream> #include <cstdio> #include <cs ...

  5. 简单几何(极角排序) POJ 2007 Scrambled Polygon

    题目传送门 题意:裸的对原点的极角排序,凸包貌似不行. /************************************************ * Author :Running_Time ...

  6. poj 2007 Scrambled Polygon 极角排序

    /** 极角排序输出,,, 主要atan2(y,x) 容易失精度,,用 bool cmp(point a,point b){ 5 if(cross(a-tmp,b-tmp)>0) 6 retur ...

  7. POJ 2007 Scrambled Polygon 极角序 水

    LINK 题意:给出一个简单多边形,按极角序输出其坐标. 思路:水题.对任意两点求叉积正负判断相对位置,为0则按长度排序 /** @Date : 2017-07-13 16:46:17 * @File ...

  8. ●POJ 2007 Scrambled Polygon

    题链: http://poj.org/problem?id=2007 题解: 计算几何,极角排序 按样例来说,应该就是要把凸包上的i点按 第三像限-第四像限-第一像限-第二像限 的顺序输出. 按 叉积 ...

  9. poj 2007 凸包构造和极角排序输出(模板题)

    Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10841   Accepted: 508 ...

随机推荐

  1. 九度oj 1521 二叉树的镜像

    原题链接:http://ac.jobdu.com/problem.php?pid=1521 水题,如下.. #include<algorithm> #include<iostream ...

  2. [SRH.Docker] HBase Java 第一天学习记录

    主要对HBase Table 的 简单操作, 直接上代码吧!!! http://pan.baidu.com/s/1hqzTTze       ui92

  3. Entity Framework 泛型使用

    因为增删改查是我们常用到的方法,我们不可能每个数据模型都去完成增删改查,这样的办法太笨拙了.我们可以写个父类(包含增删改查),然后让所有的数据模型类继承该父类.那就要求我们的父类必须使用泛型来实现. ...

  4. bootstrap bootstrapTable 隐藏列

    主要代码: <script type="text/javascript"> $(function () { LoadingDataListOrderRealItems( ...

  5. python time,string 转换

    1. 将字符串转换成时间,字符串格式为05/16/2015 datetime.datetime.strptime(STRING,"%m/%d/%Y") 2. 将时间转换成字符串:格 ...

  6. angularjs resources

    http://tutorials.jenkov.com/angularjs/watch-digest-apply.html http://angular-tips.com/blog/2013/08/w ...

  7. iframe 传值问题

    当一个页面中插入了iframe或者由不同的框架组成(fieldset)时,这种情况下,需要处理的业务逻辑比较常见的就是数据进行交互了 1.页面中插入了iframe情况 由于页面中插入了iframe,那 ...

  8. The income statement

    The income statement measures performance over some period  of time,usually a quarter or a year.The ...

  9. 转载—“Cache-control”常见的取值有private、no-cache、max-age、must-revalidate等

    转载自http://www.cnblogs.com/igin/archive/2008/05/04/1181056.html 网页的缓存是由HTTP消息头中的“Cache-control”来控制的,常 ...

  10. 02.JSP的3个编译指令

    本章介绍JSP的3个编译指令,在JSP中常见的编译指令有如下3个:         1.page:用于针对当前页面的指令.         2.include:用于指定包含另一个页面.         ...