极角排序,其实是叉乘排序

#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector> using namespace std; #define eps 1e-8 struct point
{
double x, y;
} s; double getangle(point a)
{
return atan2(a.y, a.x);
}
double xmult(point p1, point p2, point p0)
{
return (p1.x - p0.x)*(p2.y - p0.y) - (p2.x - p0.x)*(p1.y - p0.y);
}
bool operator < (point a, point b)
{
return xmult(a, b, s) > eps;
} int main()
{
vector<point> p;
double a, b;
//freopen("D:\\b.txt", "r", stdin);
cin >> s.x >> s.y;
while (cin >> a >> b)
{
point temp;
temp.x = a, temp.y = b;
p.push_back(temp);
}
sort(p.begin(), p.end());
cout << "(0,0)" << endl;
for (vector<point>::iterator it = p.begin(); it != p.end(); ++it)
{
cout << '(' << (*it).x << ',' << (*it).y << ')' << endl;
}
}

poj2007的更多相关文章

  1. poj2007极角排序

    裸的极角排序,但是要把0,0放在第一个(话说这题题目真是巨长,废话也多...) #include<map> #include<set> #include<cmath> ...

  2. poj2007(极角排序)

    利用叉积按照逆时针方向进行极角排序, #define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include<algorithm&g ...

  3. OJ题目分类

    POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...

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

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

  5. 【kuangbin专题】计算几何_凸包

    1.poj1113 Wall 题目:http://poj.org/problem?id=1113 题意:用一条线把若干个点包起来,并且线距离任何一个点的距离都不小于r.求这条线的最小距离是多少? 分析 ...

随机推荐

  1. WampServer修改端口及菜单Localhost

    一.修改Apache端口 1.在界面中选Apache,弹出隐藏菜单选项,打开配置文件httpd.conf: 2.找到 Listen 80: 3.将 80 改成 8080(当然自己也可以设定别的不使用的 ...

  2. IOS DLNA开发(CyberLink和PlatinumKit)

    1.CyberLink 和 PlatinumKit 两者的比较 CyberLink大概在2010年之后功能就没有更新,部分功能不够完善,网上有下载地址 http://www.pudn.com/down ...

  3. Unable to load configuration. - bean - jar: ....struts2-core-2.1.8.1.jar!/struts-default.xml:47:178

    摘录的异常代码: 2013-12-14 22:42:07 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error严重: Dis ...

  4. for语句嵌套使用 实现9*9乘法表

         这个实例主要考察对for循环语句的使用,出现递增规律的乘法表. 开发环境      开发工具:Microsoft Visual Studio2010 旗舰版 具体步骤      先是制作一个 ...

  5. 谈谈android 布局 的优化

    来自:http://www.cnblogs.com/youxilua/archive/2012/05/08/2489414.html 导言 设配android的屏幕一定是一个噩梦,就好比那些搞网页设计 ...

  6. Http和Socket连接的区别

    Http和Socket连接区别 相信不少初学手机联网开发的朋友都想知道Http与Socket连接究竟有什么区别,希望通过自己的浅显理解能对初学者有所帮助. 1.TCP连接 要想明白Socket连接,先 ...

  7. html5桌面通知,notification的使用,右下角出现通知框

    1先判断浏览器是否支持:window.Notification 2判断浏览器是否开启提示的权限:Notification.permission === 'granted'(如果不允许则设置为允许:No ...

  8. swfobject.js IE兼容问题

    错误代码 在562行左右 / add style rule if (ua.ie && ua.win) { if (dynamicStylesheet && typeof ...

  9. 香港house of hello品牌包包是怎样被模仿呢?

    今天,作为女性的朋友来说,house of hello包包可能对大家都不会陌生吧,特别是一些白领阶层的女性同胞们,这个品牌比较熟悉,现在,也有网友称,这个是恶搞包包.house of hello包包原 ...

  10. George and Cards

    Codeforces Round #227 (Div. 2) E:http://codeforces.com/contest/387/problem/E 题意:给你一个n个数的序列,然后给你一个标准序 ...