2012年2月1日
摘要: 先介绍几种极角排序:1.利用叉积的正负来作cmp.(即是按逆时针排序).此题就是用这种方法1 bool cmp(const point &a, const point &b)//逆时针排序 2 {3 point origin;4 origin.x = origin.y = 0;5 return cross(origin,b,origin,a) < 0;6 }2.利用complex的内建函数。 1 #include<complex> 2 #define x real() 3 #define y imag() 4 #include<algorithm> 阅读全文
posted @ 2012-02-01 18:08 Dev-T 阅读(6131) 评论(3) 推荐(0) 编辑
摘要: 此题让我WA了N次。。。坑呐。。。需要注意几点(血淋淋的教训):1.有可能出现一种情况,它给出的是5个点,但这个有可能是三角形,因为有4个点在同一边上.2.R == 0的情况(如果点在边上时返回正确)。。3.给出的点的顺序可能为顺时针或者逆时针。View Code 1 #include<iostream> 2 #include<cmath> 3 #define EPS 1e-8 4 using namespace std; 5 struct point { 6 double x, y; 7 }pol[2000]; 8 9 int nver; 10 poin... 阅读全文
posted @ 2012-02-01 14:55 Dev-T 阅读(1144) 评论(0) 推荐(1) 编辑