POJ
RuHua27
这个作者很懒,什么都没留下…
展开
-
POJ 3468 A Simple Problem with Integers(线段树,裸)
第一次写区间修改的线段树。update(): 成段增减query(): 区间求和#include using namespace std;typedef long long LL;const int maxn = 110000;LL sum[maxn<<2];LL add[maxn<<2];void pushUp(int rt){ sum[rt] = sum[原创 2013-12-25 10:17:40 · 353 阅读 · 0 评论 -
POJ 1474 Video Surveillance(半平面交)
和POJ3335几乎一样。。//poj1474#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;const double eps = 1e-8;const do原创 2014-06-23 18:20:52 · 381 阅读 · 0 评论 -
POJ 2451 Uyuw's Concert(半平面交,求面积,裸)
RT。。#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;const double eps = 1e-8;const double PI = acos(-1.0)原创 2014-06-30 21:46:37 · 360 阅读 · 0 评论 -
POJ 3449 Geometric Shapes (多边形相交)
思路比较简单,输入输出哟原创 2014-05-27 15:27:21 · 440 阅读 · 0 评论 -
POJ 1584 A Round Peg in a Ground Hole(判断凸多边形,点到线段最短距离)
圆在多边形内的条件是:圆心在多边形内,且圆心到个原创 2014-05-27 15:30:03 · 524 阅读 · 0 评论 -
POJ 3384 Feng Shui(半平面交)
题意:在一个多边形里放两个馆原创 2014-06-30 21:45:06 · 368 阅读 · 0 评论 -
POJ 1228 (凸包)
题意看了很久才懂。。判断给定的凸包能否we原创 2014-05-28 22:48:45 · 531 阅读 · 0 评论 -
POJ 2007 (极角排序)
极角排序裸题。。原创 2014-05-28 22:50:53 · 702 阅读 · 0 评论 -
POJ 1873 (枚举子集+凸包)
很久以前的 final 里的水题。。原创 2014-05-28 22:54:59 · 500 阅读 · 0 评论 -
POJ 2420 A Star not a Tree?(随机变步长贪心)
第一次做随机算法的题目。首先随机一个点,ran原创 2014-07-23 22:39:52 · 268 阅读 · 0 评论 -
POJ 1945 Power Hungry Cows(打表技巧)
这题正解貌似是启发式搜索,直接暴搜的话超时,但是又chaod原创 2014-07-23 22:28:42 · 7384 阅读 · 1 评论 -
POJ 1755 Triathlon(n^2 半平面交, 两点式和参数式直线求交点)
感觉就是处理成不等式然后求半平面交,但是用 nlogn 的那个模板过不去,houl原创 2014-07-23 22:26:27 · 630 阅读 · 0 评论 -
POJ 3348 Cows (凸包面积)
#include#include#include#includeusing namespace std;const int MAXN=1000;const double PI=acos(-1.0);struct Point{ double x,y; Point(){} Point(double _x,double _y) { x =原创 2014-05-29 22:50:18 · 400 阅读 · 0 评论 -
POJ 1654 Area (有向面积求多边形面积)
#include #include #include #include using namespace std;struct Point{ double x,y; Point(){} Point(double _x,double _y) { x = _x;y = _y; } //向量 Point operator原创 2014-05-29 22:51:57 · 554 阅读 · 0 评论 -
POJ 2002 Squares (已知正方形对角线两点推另外两点,STL set)
枚举正方形对角线两点,推出lingw原创 2014-07-23 22:38:01 · 874 阅读 · 0 评论 -
POJ1375 Intervals(解析几何,圆)
解析利用角度之间的关系推出公式原创 2014-07-31 19:29:41 · 410 阅读 · 0 评论 -
POJ2187 Beauty Contest(最远点对,凸包+旋转卡壳)
最远点对裸题。#include#include#include#includeusing namespace std;const int MAXN=5e4+100;struct Point{ int x,y; Point(){} Point(int _x,int _y) { x = _x;y = _y; } //向原创 2014-07-31 19:33:38 · 304 阅读 · 0 评论 -
POJ 3335 Rotating Scoreboard (半平面交)
显然如果对所有墙壁求半平面交结果原创 2014-06-23 18:08:01 · 355 阅读 · 0 评论 -
POJ 1279 Art Gallery
半平面交,求多边形核的面积原创 2014-06-23 19:23:14 · 305 阅读 · 0 评论 -
POJ 2954 Triangle(pick定理,边上整点数)
RT。。#include #include #include #include using namespace std;const double eps = 1e-8;int sgn(double x){ if(fabs(x) < eps)return 0; if(x < 0)return -1; else return 1;}struct Poin原创 2014-06-23 17:15:59 · 383 阅读 · 0 评论 -
POJ 2449 Remmarguts' Date(k短路)
学习了 k 短路的 A* 算法,A* 是一种求最短路的启发式方法,感觉挺厉害的。维护一个结点的优先队列,每次优先让估值函数 f() 值最小的结点出队,对其所有邻接点进行松弛。假设出队的结点是 x,且这是 x 第 m 次出队,则表示 s 到 x 的 m 短路已解出,原理类似于BFS。其中估值函数 f(x) = g(x) + h(x)g(x) 为从起点 s 到点 x 的实际代原创 2014-01-25 20:57:26 · 440 阅读 · 0 评论 -
POJ 3463 Sightseeing (次短路,Dijkstra拓展)
据说用 A* 求 k 短路,令 k = 2 ,会爆栈。做这道题目主要还是学习为主。。显然求最短路和次短路的数量,再判断二者是不是差 1 即可。由于要求次短路,对 Dijkstra 进行修改。dis[] 数组不再只存最短路,而是用二维数组同时存最短路和次短路,初始化只有起点 s 的最短路是 0,其他均为 inf用 cnt[][2] 来计数,第一维伟最短路数量,第二维为次短路数量,原创 2014-01-25 21:35:03 · 470 阅读 · 0 评论 -
POJ 3013 Big Christmas Tree(Dijkstra,裸)
一道比较裸的 Dijkstra。不过好像还是再某些。。细节上卡了。。。很久我对 Dijkstra 的理解:维护一个优先队列,优先让当前路径估计值最短的结点出队,并对其邻接点进行松弛。可以保证出队结点的路径估计即为源点到该点的最短路,因为如果还存在更优的解,则表示还存在路径估计更小的点,出现矛盾。#include #include #include #include usin原创 2014-01-25 21:08:02 · 477 阅读 · 0 评论 -
POJ 1251 Jungle Roads(超裸MST)
就当恢复手感了,最近刷刷图论。。。人弱不拆...刚开始路径压缩那里有个小bug,已经注释了#include #include using namespace std;const int maxe = 220, maxv = 30;typedef struct Edge { int fr, to, wt;}Edge;Edge edge[maxe];bool cm原创 2014-01-20 12:08:42 · 471 阅读 · 0 评论 -
POJ 1269 Intersecting Lines(直线位置关系,水)
利用叉积判断直线位置关系,叉积为0则共线或ping原创 2014-04-09 21:09:57 · 386 阅读 · 0 评论 -
POJ 3304 Segments(线段直线相交)
题意:求是否有一条直线,与给出的所有原创 2014-04-15 12:20:08 · 317 阅读 · 0 评论 -
1066 Treasure Hunt (判断线段相交)
题意:100 * 100 的封闭房子,有一些贯穿整个房子的墙(从一题边到另一边原创 2014-04-15 13:33:32 · 300 阅读 · 0 评论 -
POJ 1410 Intersection(线段相交)
判断线段是否与矩形有交集。。刚开始看成直线错了好几发。。原创 2014-04-15 21:16:43 · 310 阅读 · 0 评论 -
POJ 3347 Kadj Squares(技巧)
题意挺简单,思路也不难,但是开始一直WA。这里的技巧就是原创 2014-04-17 12:01:03 · 416 阅读 · 0 评论 -
POJ 1696 Space Ant(卷包裹)
这题严格来说不是凸包的题,只是用到了凸包的卷包裹原创 2014-04-17 19:26:52 · 350 阅读 · 0 评论 -
POJ 1039 Pipe(线段直线相交)
终于把这题过了。。。体会到了计算几何的特点原创 2014-04-24 13:14:26 · 381 阅读 · 0 评论 -
POJ 2398 Toy Storage(叉乘,水)
和POJ 2318 几乎一模一样,只是多了个排序,然后输出格式个原创 2014-04-08 12:59:44 · 561 阅读 · 0 评论 -
POJ 2318 TOYS (矩形内判断点与线段关系,水)
第一道计算几何的题,非常水。。感觉计算几何里有各种结构体。。原创 2014-04-07 21:06:30 · 357 阅读 · 0 评论 -
POJ 2653 Pick-up sticks(判断线段相交)
题意:按顺序扔一些木棒,问最后在最上面的木棒。原创 2014-04-10 21:24:46 · 267 阅读 · 0 评论 -
POJ 1556 The Doors(判断线段相交 + 最短路)
RT。。题意和思路不是很复杂原创 2014-04-12 20:28:29 · 382 阅读 · 0 评论 -
POJ 3130 How I Mathematician Wonder What You Are!(半平面交)
和 POJ3335 几乎一模一样。。//poj3130#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;const double eps = 1e-8;cons原创 2014-06-23 18:14:50 · 368 阅读 · 0 评论 -
POJ1329 Circle Through Three Points(解析几何,圆)
推出圆的公式即可。原创 2014-07-31 19:31:32 · 377 阅读 · 0 评论