题目链接:http://poj.org/problem?id=2007 题意:乱序给出凸多边形的顶点坐标,要求按逆时 针顺序输出各顶点.给的第一个点一定是 (0,0),没有其他点在坐标轴上,没有三点 共线的情况. 可以运用叉积进行排序,矢量p1×p2 > 0说明p1逆时针旋转<180度可以得到p2; /*乱序给出凸多边形的顶点坐标,要求按逆时针顺序输出各顶点.给的第一个点一定是(0,0),没有其他点在坐标轴上,没有三点共线的情况.*/ #include<stdio.h> #incl…
题目链接 题意 : 对输入的点极角排序 思路 : 极角排序方法 #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…
水题,根本不用凸包,就是一简单的极角排序. 叉乘<0,逆时针. #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> using namespace std; const int maxn=55; struct point { double x,y; } p[maxn]; double cross(poi…
题意: 给你n个点,这n个点可以构成一个多边形(但是不是按顺序给你的).原点(0,0)为起点,让你按顺序逆序输出所有点 题解: 就是凸包问题的极角排序 用double一直Wa,改了int就可以了 //原点(0,0)为起点,逆序输出多边形的点 #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> #include<queue> #include<…
http://poj.org/problem?id=2007 Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6701   Accepted: 3185 Description A closed polygon is a figure bounded by a finite number of line segments. The intersections of the bounding line segments ar…
Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8636   Accepted: 4105 Description A closed polygon is a figure bounded by a finite number of line segments. The intersections of the bounding line segments are called the…
Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7799   Accepted: 3707 Description A closed polygon is a figure bounded by a finite number of line segments. The intersections of the bounding line segments are called the…
Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7214   Accepted: 3445 Description A closed polygon is a figure bounded by a finite number of line segments. The intersections of the bounding line segments are called the…
Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17937   Accepted: 4957 Description You are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate system. From thi…
利用叉积按照逆时针方向进行极角排序, #define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include<algorithm> #include<fstream> using namespace std; struct Point{ int x, y; Point(int a = 0, int b = 0) :x(a), y(b){} }; Point operator-(Point a, Point b){ ret…