POJ-2007
来源:互联网 发布:勋兴魂蛋cp 知乎 编辑:程序博客网 时间:2024/05/18 11:47
G++要用%f而C++要用%lf
极角排序
#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>#include <climits>#include <ctime>#include <iostream>#include <algorithm>#include <vector>#include <stack>#include <queue>#include <string>#include <map>#include <set>#include <utility>using namespace std;struct P{ double x, y; P() {} P(double x, double y) : x(x), y(y) {} P operator +(const P &p) { return P(x + p.x, y + p.y); } P operator -(const P &p) { return P(x - p.x, y - p.y); } P operator *(const double &d) { return P(x * d, y * d); } P operator /(const double &d) { return P(x / d, y / d); } bool operator ==(const P &p) { return x == p.x && y == p.y; } P operator =(const P &p) { x = p.x, y = p.y; return *this; } double det(const P &p) { return x * p.y - y * p.x; } double dot(const P &p) { return x * p.x + y * p.y; }};P in_arr[500];bool Graham_cmp(P a, P b){ P origin(0.0, 0.0); return (a - origin).det(b - origin) > 0;}int main(){// freopen("in.in", "r", stdin); int i = 0; while(scanf("%lf %lf", &in_arr[i].x, &in_arr[i].y) != EOF) { i += 1; } sort(in_arr + 1, in_arr + i, Graham_cmp); for(int j = 0; j < i; ++j) printf("(%.0lf,%.0lf)\n", in_arr[j].x, in_arr[j].y);return 0;}
0 0
- poj 2007
- POJ-2007
- poj 2007
- poj 2007 Scrambled Polygon
- poj 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- POJ 2007 Scrambled Polygon
- POJ 2007 简单几何
- 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
- poj
- POJ
- Linux文件操作
- 向量点乘 和 叉乘
- 判别训练的多尺度可变形部件模型 A Discriminatively Trained, Multiscale, Deformable Part Model
- OC @property 和 @synthesize 关键字
- 7-1通信系统中为什么要进行编码和解码?常见的编码方法有哪些?
- POJ-2007
- 防止锚点(带“#”号)URL请求服务器解决
- 在DM8168中通过live555实现rtsp的直播(部分修改)
- 360 产品星计划 笔试感想
- SDUTOJ 3043 迷之容器 线段树求全局第k小
- 06集合-AngularJS基础教程
- 南阳理工ACM954--N!
- Qtcreator 在红帽 无法启动,很可能是gcc版本问题:解决/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found问题
- 简单博弈论