poj 1696(极角排序)】的更多相关文章

Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4970   Accepted: 3100 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y19…
#include<iostream> #include<cmath> #include<algorithm> using namespace std; double eps=1e-8; int sgn(double x) { if(fabs(x)<=eps)return 0; if(x<0)return -1; return 1; } struct Point { double x,y; int index; Point (){} Point(double…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3924   Accepted: 2457 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y19…
题意: 给你n个点,这n个点可以构成一个多边形(但是不是按顺序给你的).原点(0,0)为起点,让你按顺序逆序输出所有点 题解: 就是凸包问题的极角排序 用double一直Wa,改了int就可以了 //原点(0,0)为起点,逆序输出多边形的点 #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> #include<queue> #include<…
POJ 2007 将所有的点按逆时针输出 import java.io.*; import java.util.*; public class Main { static class Point implements Comparable<Point>{ double x, y; @Override public int compareTo(Point a) { return (int)cross(a); } public double cross(Point a){ return a.x*y…
http://poj.org/problem?id=1696 极角排序是就是字面上的意思   按照极角排序 题目大意:平面上有n个点然后有一只蚂蚁他只能沿着点向左走  求最多能做多少点 分析:  其实还不知道极角排序到底是什么,   但是又好像知道一点   必须一直排序  然后一直找到最左的点就行了 #include<stdio.h> #include<math.h> #include<algorithm> #include<iostream> #inclu…
链接:http://poj.org/problem?id=1696 Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3077   Accepted: 1965 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an a…
题意:平面上有n个点,一只蚂蚁从最左下角的点出发,只能往逆时针方向走,走过的路线不能交叉,问最多能经过多少个点. 思路:每次都尽量往最外边走,每选取一个点后对剩余的点进行极角排序.(n个点必定能走完,这是凸包的性质决定的) #include<stdio.h> #include<string.h> #include<math.h> #include<iostream> #include<algorithm> using namespace std;…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2489   Accepted: 1567 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y19…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2876   Accepted: 1839 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y19…