POJ 2007 Scrambled Polygon
来源:互联网 发布:阿里云黑洞 编辑:程序博客网 时间:2024/06/05 05:53
向量叉积a,b如果为正,那么a在b的逆时针180度内,否则b在a的逆时针180度内,所以只要叉积排序就可以。
尽量使用cmp,重载运算符需要在结构体内。
#include<cstdio>#include<vector>#include<algorithm>using namespace std;typedef pair<int,int> Point;int operator ^ (Point p,Point q){ return p.first*q.second-p.second*q.first;}bool cmp(const Point p,const Point q) { return (p^q)>0;}int main(){ vector<Point> v; int x,y; while(scanf("%d%d",&x,&y)!=EOF) v.push_back(make_pair(x,y)); sort(v.begin()+1,v.end(),cmp); for(int i=0;i<(int)v.size();i++) printf("(%d,%d)\n",v[i].first,v[i].second); return 0;}
0 0
- 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
- POJ 2007 Scrambled Polygon .
- POJ 2007 Scrambled Polygon
- poj 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon(几何)
- POJ 2007 Scrambled Polygon 笔记
- zoj 2352 || poj 2007 Scrambled Polygon
- poj 2007 Scrambled Polygon--按极角排序
- poj 2007 Scrambled Polygon 极角排序
- POJ 2007 Scrambled Polygon(极角排序)
- POJ 2007 Scrambled Polygon(凸包)
- CSS浮动详解(1)
- float详解(2)
- 如何选购无线路由器
- max-width
- CSS定位属性Position详解
- POJ 2007 Scrambled Polygon
- HTML5替代div的元素
- 电脑端一些快捷开源创建平台
- 手机版制作H5页面免费工具大集合
- 自建网页服务器基础
- 【HD 1596】find the safest road
- Java基础知识整理2
- 免费开源网站系统有哪些
- O2O、C2C、B2B、B2C的区别