随笔分类 -  计算几何——二维基本运算

摘要:题目链接:http://acm.buaa.edu.cn/problem/59/想法:由于要有最少的扇形来覆盖所有的点,点有哪么多,肯定是贪心算法,想到一个在一条直线上的很多点,要用最少区间去覆盖所有点,这个是贪心,只需要从最左边第一个点开始覆盖即可。 但这个题是平面上的,如何贪心? 这里想到由于必要有个扇形覆盖的起点,不可能每个都枚举,那个更可能?? 我的想法是:找到任意两个点间最大的间隔角度,起点从其中一个开始,就转换成直线上区间覆盖点的问题了。代码:#include#include#include#include#includeusing namespace std;const doub. 阅读全文
posted @ 2013-12-06 21:30 等待最好的两个人 阅读(295) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1106算法思路:由于圆心和半径都确定,又是180度,这里枚举过一点的直径,求出这个直径的一个在圆上的端点,就可以用叉积的大于,等于,小于0判断点在直径上,左,右。 这里要记录直径两边的加直径上的点的个数,去最大的。代码:#include#include#include#include#include#includeusing namespace std;const double eps = 1e-8;const double PI = acos(-1.0);const double INF = 1000000000000000.0 阅读全文
posted @ 2013-10-05 19:25 等待最好的两个人 阅读(166) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1329输出很蛋疼,要考虑系数为0,输出也不同#include#include#include#include#include#includeusing namespace std;const double eps = 1e-8;const double PI = acos(-1.0);const double INF = 1000000000000000.000;struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y) { } //构造函... 阅读全文
posted @ 2013-10-05 19:19 等待最好的两个人 阅读(291) 评论(0) 推荐(0)
摘要:题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1046参考博客:http://hi.baidu.com/cloudygoose/item/21fee021a5db348d9d63d17b参考资料(向量的旋转):http://www.cnblogs.com/woodfish1988/archive/2007/09/10/888439.html题目大意:就是已知n个点,n个角。点Mi可以与多边形Ai和Ai+1构成等腰三角形,顶角为ang[i]. 现在要你求出这个多边形的n的顶点。算法思路:刚开始想几何性质,怎么也想不出来一个好的思路。没 阅读全文
posted @ 2013-09-24 22:42 等待最好的两个人 阅读(729) 评论(0) 推荐(0)
摘要:题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1333#include#include#include#include#include#includeusing namespace std;const double eps = 1e-8;const double PI = acos(-1.0);const double INF = 1000000000000000.000;struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ } //构造函... 阅读全文
posted @ 2013-09-13 10:13 等待最好的两个人 阅读(173) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#includeusing namespace std;const double eps = 1e-8;const double PI = acos(-1.0);const double INF = 1000000000000000.000;struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ } //构造函数};typedef Point Vector;Vector operator + (Vector A , ... 阅读全文
posted @ 2013-09-13 00:01 等待最好的两个人 阅读(199) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#includeusing namespace std;const double eps = 1e-8;const double PI = acos(-1.0);const double INF = 100000000.000000;struct Point{ int index; double x,y; Point(double x=0, double y=0) : x(x),y(y){ } //构造函数};typedef Point Vector;Vector operator + (V... 阅读全文
posted @ 2013-09-11 10:28 等待最好的两个人 阅读(165) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4666#include #include #include #include #include #include using namespace std;const int maxn = 60060;struct MaxHeap{ int d; //k维的各种加或减的和; int p; //每个坐标和所属的标号 MaxHeap(int d=0,int p=0):d(d),p(p) {} boo... 阅读全文
posted @ 2013-08-14 18:54 等待最好的两个人 阅读(246) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2926#include#include#include#include#include#include#includeusing namespace std;const int INF = 0x3f3f3f;float Max[32]; //Max[i]表示第i种的最大;float Min[32];int N;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); cin>>N; for(int i=0;i<32;i++ 阅读全文
posted @ 2013-08-14 16:59 等待最好的两个人 阅读(163) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2318#include#include#include#include#include#includeusing namespace std;const int maxn = 5105;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){... 阅读全文
posted @ 2013-08-11 22:31 等待最好的两个人 阅读(185) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1269#include#include#include#include#include#includeusing namespace std;const int maxn = 105;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ ... 阅读全文
posted @ 2013-08-11 21:50 等待最好的两个人 阅读(145) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3304#include#include#include#include#include#includeusing namespace std;const int maxn = 105;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ ... 阅读全文
posted @ 2013-08-11 21:26 等待最好的两个人 阅读(219) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1556#include#include#include#include#include#includeusing namespace std;const int maxn = 1000;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){... 阅读全文
posted @ 2013-08-11 17:46 等待最好的两个人 阅读(169) 评论(0) 推荐(0)
摘要:题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2896大概思路:A和B运动,以A(Posa)为参考点,求出B的运动轨迹(Posb -> Posb + Vb-Va);#include#include#include#include#include#includeusing namespace std;const int maxn = 60;const int maxe = 100000;const int INF 阅读全文
posted @ 2013-08-07 22:16 等待最好的两个人 阅读(252) 评论(0) 推荐(0)
摘要:题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1264#include#include#include#include#include#includeusing namespace std;const int maxn = 310;const int maxe = 100000;const int INF = 0x3f3f3f;struct Point{ double x,y; Point(double 阅读全文
posted @ 2013-08-07 16:38 等待最好的两个人 阅读(230) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#include#includeusing namespace std;struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ } //构造函数};typedef Point Vector;Vector operator + (Vector A , Vector B){return Vector(A.x+B.x,A.y+B.y);}Vector operator - (Vector A , Vector B){ret... 阅读全文
posted @ 2013-08-07 14:55 等待最好的两个人 阅读(133) 评论(0) 推荐(0)