题目链接

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

思路 : 极角排序方法

#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. hdu 2034 人见人爱A-B

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2034 人见人爱A-B Description 参加过上个月月赛的同学一定还记得其中的一个最简单的题目, ...

  2. 关于asp.net和iis的进程/线程问题,假如网站有1000个人访问,会产生多少个进程/线程啊

    详解 ASP.NET异步   超好的文章

  3. 三星Galaxy Note 10.1 N8010 最后的救赎 Andorid 5.0.2 ROM

    上市日期为2012年的三星Galaxy Note N8010 10.1采用10.1英寸TFT屏幕,分辨率为1280×800,支持10点触控,支持S pen手写笔功能.,拥有一颗1.4GHz Exyno ...

  4. c/c++常用代码--使用libcurl下载文件

    #pragma once #include <stdio.h>#include <stdlib.h> #include <curl/curl.h> #ifdef   ...

  5. python并行迭代

    并行迭代:同时并行遍历两个列表 for line1,line2 in zip(line1_list, line2_list): ... 无聊,贴一段刚才的代码: import sys import s ...

  6. TList,TObjectList 使用——资源释放

    TOjectList = Class (Tlist); TOjectList继承Tlist,从名字上看就可以知道它是专门为对象列表制作的,那么他到底丰富了那些功能呢? 首先是 TObject 作为对象 ...

  7. responsive menu

    http://responsive-nav.com/#instructions https://github.com/viljamis/responsive-nav.js http://tympanu ...

  8. c++ _beginthread

    c++多线程编程 #include <windows.h> #include <process.h> /* _beginthread, _endthread */ #inclu ...

  9. apache与tomcat负载集群的3种方法

    花了两天时间学习apache与tomcat的集成方法,现在把学习成果记录下来. apache与tomcat负载集群集成方法有3种jk.jk_proxy.http_proxy 本次集成使用的软件版本: ...

  10. 【Validate Binary Search Tree】cpp

    题目: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is define ...