![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
POJ
文章平均质量分 70
紫杉丶
这个作者很懒,什么都没留下…
展开
-
POJ 2565 Average is not Fast Enough!
注意下格式就好。。#include "stack"#include "cstdio"#include "iostream"#include "cmath"#include "set"#include "sstream"#include "cctype"#include "string"#include "cstring"#include "algorithm原创 2015-02-09 18:49:59 · 372 阅读 · 0 评论 -
POJ 1113 Wall
求围墙的长度 就是里面凸包的周长+半径为L的圆周长#include "cstring"#include "iostream"#include "algorithm"#include "cstdio"#include "queue"#include "set"#include "cmath"using namespace std;typedef long long LL;con原创 2015-07-20 19:18:46 · 293 阅读 · 0 评论 -
POJ 2104 K-th Number (主席树 || 划分树)
静态区间查询第K大 主席树入门//#include #include #include #include #include using namespace std;const int MAXN = 100010;const int M = MAXN * 30;int n,q,m,tot;int a[MAXN], t[MAXN];int T[M], lson[M], r原创 2015-08-03 13:55:46 · 274 阅读 · 0 评论 -
POJ 3020 Antenna Placement (Hungary)
求最小覆盖边, 无向二分图的最小路径覆盖 = 顶点数 – 最大二分匹配数/2 由于构图过程中匹配双向的,所以匹配数多了一倍,最后要/2 构图可以用奇偶,或者用数来标记//#pragma comment(linker, "/STACK:102400000,102400000")#include #include #include #include #include usi原创 2015-08-15 10:08:30 · 421 阅读 · 0 评论 -
POJ 1743 Musical Theme (不可重叠最长重复子串)
后缀数组+二分答案题目:找到一个字符串内长度不小于五的最长不重复字串,字串的所有数字同时加上或减去一同一个数也算重复出现。解析:首先最所有数字作差,原数据为a[i]新数据为a[i]=a[i+1]-a[i],这样一来及时原先的字串是进行过加或减那他们的差值也会相同,所以转换为求现有a[]中大与5的最长重复字串,用后缀数组。首先由二分答案的方法将问题变成判定性的:长度大于k的重复字串有没有原创 2015-09-07 10:52:36 · 309 阅读 · 0 评论 -
POJ 3261 Milk Patterns (可重叠的出现K次的最长重复子串)
//#pragma commmpnt(linkmpr, "/STACK:102400000,102400000")#include #include #include #include #include using namespace std;typedef long long LL;const int M = 10055;/* *suffix array *倍增算法 O(n原创 2015-09-07 12:01:49 · 298 阅读 · 0 评论 -
POJ 3616 Milking Time(DP)
dp[i]= i-1时间段产奶量 + 现在的产奶量#include#include#include#include#includeusing namespace std;typedef long long LL;const int M = 10000;const int INF = 0x3f3f3f3f;struct node{ int st, et, w; boo原创 2015-10-18 21:05:32 · 275 阅读 · 0 评论 -
POJ 2533 Longest Ordered Subsequence (LIS)
最长上升子序列O(n*logn)//#pragma commmpnt(linkmpr, "/STACK:102400000,102400000")#include #include #include #include #include #include using namespace std;typedef long long LL;const int M = 10001原创 2015-10-07 19:30:36 · 268 阅读 · 0 评论 -
POJ 3186 Treats for the Cows (DP)
从里到外逆推//#pragma commmpnt(linkmpr, "/STACK:102400000,102400000")#include #include #include #include #include #include using namespace std;typedef long long LL;const int M = 100010;const int原创 2015-10-08 21:33:22 · 380 阅读 · 0 评论 -
POJ 1330 Nearest Common Ancestors (LAC)
LCA转RMQ 在线算法,,,//#pragma commmpnt(linkmpr, "/STACK:102400000,102400000")#include #include #include #include #include #include using namespace std;typedef long long LL;const int M = 100010;原创 2015-09-20 10:51:12 · 285 阅读 · 0 评论 -
POJ 1661 Help Jimmy (DP)
dp[i][j], j = 0, 1 (dp[i][0]表示以i号平台左边为起点到地面的最短时间,dp[i][1]]表示以i号平台右边为起点到地面的最短时间)状态转移方程:dp[i][0] = H[i] - H[m] + Min (dp[m][0] + X1[i] - X1[m], dp[m][1] + X2[m] - X1[i]); m为i左边下面的平台的编号dp[i][1]原创 2015-10-10 21:06:45 · 279 阅读 · 0 评论 -
POJ 3083 Children of the Candy Corn(BFS + DFS)
优先左转 优先右转 两点最短#include#include#include#include#include#include#includeusing namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const int M = 1010;int dir[][2] = { 0,-1,-1,0,0原创 2015-10-26 23:03:33 · 380 阅读 · 0 评论 -
POJ 2420 A Star not a Tree?
求多边形的费马点,,爬山算法#include "cstring"#include "iostream"#include "algorithm"#include "cstdio"#include "queue"#include "set"#include "cmath"using namespace std;typedef long long LL;const int M=51原创 2015-07-20 18:47:51 · 284 阅读 · 0 评论 -
POJ 3304 Segment
直线与线段相交,枚举直线的端点 用叉积判断是否有交点#include "cstring"#include "iostream"#include "algorithm"#include "cstdio"#include "queue"#include "set"#include "cmath"using namespace std;typedef long long LL;co原创 2015-07-20 21:00:36 · 255 阅读 · 0 评论 -
POJ 2926 Requirements (多维最远曼哈顿距离)
考虑二维空间上两个坐标之间的曼哈顿距离(x1, y1) 和 (x2, y2),|x1-x2| +|y1-y2|去掉绝对值符号后共有下列四种情况(x1-x2) + (y1-y2), (x1-x2) + (y2-y1), (x2-x1) + (y1-y2), (x2-x1) + (y2-y1)转化一下:(x1+y1) - (x2+y2), (x1-y1) - (x2原创 2015-08-07 13:55:09 · 722 阅读 · 0 评论 -
POJ 2190 ISBN
细心点做就妥妥的,, # include int main (){ char str[20] ; int sum, i, pos ; while (gets(str)) { sum = 0 ; for (i = 0 ; str[i] ; i++) { if (原创 2015-02-09 18:47:10 · 591 阅读 · 0 评论 -
POJ 2524 Ubiquitous Religions
并查集水过~~ #include "stack"#include "cstdio"#include "stdio.h"#include "iostream"#include "math.h"#include "set"#include "sstream"#include "cctype"#include "string"#include "cstring原创 2015-02-09 18:54:21 · 498 阅读 · 0 评论 -
POJ 2403 Hay Points
用C++ string处理 水的不行#include "stack"#include "cstdio"#include "iostream"#include "cmath"#include "set"#include "sstream"#include "cctype"#include "string"#include "cstring"#include "原创 2015-03-07 18:30:29 · 343 阅读 · 0 评论 -
POJ 1847 Tram (Floyd)
用floyd模板套一套就可以 ..#include "stack"#include "cstdio"#include "iostream"#include "cmath"#include "set"#include "sstream"#include "cctype"#include "string"#include "cstring"#include "a原创 2015-03-07 18:35:15 · 396 阅读 · 0 评论 -
POJ 3660 Cow Contest
题目的意思是说有n头牛比赛,m种比赛结果,最后问你一共有多少头牛的排名被确定了,其中如果a战胜b,b战胜c,则也可以说a战胜c,即可以传递胜负。 这个题目考察的就是传递关系,类似于离散数学中的传递闭包。如果一头牛与所有别的牛的比赛结果都确定,就是说这头牛的位置是确定的用floyd来求出传递闭包。然后判断,输出。#include "stack"#include "cstdio"#incl原创 2015-03-07 18:37:02 · 270 阅读 · 0 评论 -
POJ 2142 The Balance(exgcd应用)
有一种天平,这种天平只有两种重量的砝码a和b,现在要称出重量为c的物品,问你至少需要多少a和b,答案需要满足a的数量加上b的数量和最小,并且他们的重量和也要最小。(两个盘都可以放砝码) 分析:这题我刚刚开始还以为是动规或者bfs,也算是碰了一鼻子的灰吧。假设a砝码我们用了x个,b砝码我们用了y个。那么天平平衡时,就应该满足ax+by==c。x,y为正时表示放在和c物品的另一边,为负时表原创 2015-03-31 22:07:27 · 413 阅读 · 0 评论 -
POJ 1860 Currency Exchange(spfa)
最短路水题,,如果货币在转换中能涨价就不用再判断了。。#include "string"#include "iostream"#include "cstdio"#include "cmath"#include "set"#include "queue"#include "vector"#include "cctype"#include "sstream"#i原创 2015-04-18 10:23:15 · 326 阅读 · 0 评论 -
POJ 2406 Power Strings(循环节)
#include "string"#include "iostream"#include "cstdio"#include "cmath"#include "set"#include "queue"#include "vector"#include "cctype"#include "sstream"#include "cstdlib"#include "c原创 2015-04-06 21:56:36 · 279 阅读 · 0 评论 -
POJ 3984 迷宫问题 (bfs 水)
#include "string"#include "iostream"#include "cstdio"#include "cmath"#include "set"#include "queue"#include "vector"#include "cctype"#include "sstream"#include "cstdlib"#include "c原创 2015-04-07 19:27:41 · 285 阅读 · 0 评论 -
POJ 1511 Invitation Cards (spfa)
求到某点的来回最短距离,数据太大,要用spfa邻接矩阵存储,将两点互换再求一次最短路,所有距离和即为所求#include "string"#include "iostream"#include "cstdio"#include "cmath"#include "set"#include "queue"#include "vector"#include "cctype原创 2015-04-19 10:13:41 · 308 阅读 · 0 评论 -
POJ 3126 Prime Path (BFS)
#include "string"#include "iostream"#include "cstdio"#include "cmath"#include "set"#include "queue"#include "vector"#include "cctype"#include "sstream"#include "cstdlib"#include "c原创 2015-04-09 21:40:18 · 294 阅读 · 0 评论 -
POJ 2676 Sudoku (DFS)
数独,开三个标记,直接暴力,400多mS还是可以接受的#include#include#include#include#include#include#includeusing namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const int M = 1010;int vish[15][15]原创 2015-10-30 14:22:46 · 349 阅读 · 0 评论