![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
POJ
文章平均质量分 71
zzuspy
本人初学者~~
展开
-
POJ - 2251 - Dungeon Master (简单BFS)
Dungeon MasterTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20450 Accepted: 7917DescriptionYou are trapped in a 3D dungeon and need to find the quic原创 2015-07-25 10:20:08 · 660 阅读 · 0 评论 -
POJ - 1061 - 青蛙的约会 (扩展欧几里得)
青蛙的约会Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 96667 Accepted: 18091Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到原创 2015-07-27 13:12:38 · 717 阅读 · 0 评论 -
POJ - 1426 - Find The Multiple (DFS)
题目传送:Find The Multiple思路:DFSAC代码:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define LL lo原创 2015-05-25 00:09:06 · 865 阅读 · 0 评论 -
POJ - 3278 - Catch That Cow (BFS)
题目传送:Catch That Cow思路:BFS找最小步数,用一个结构体存下当前结点的数值以及当前步数AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #include原创 2015-05-22 19:55:06 · 901 阅读 · 0 评论 -
HDU - 1003 - Max Sum && POJ - 1050 - To the Max (经典DP问题)
题目传送:HDU - 1003思路:最大子序列和dp[i]= a[i] (dp[i-1]dp[i]= dp[i-1]+a[i] (dp[i-1]>=0)AC代码:#include #include #include #include #include #include #include #include #include #includ原创 2015-05-07 00:41:27 · 749 阅读 · 0 评论 -
POJ - 3468 - A Simple Problem with Integers (线段树 - 成段更新)
题目传送:A Simple Problem with Integers思路:线段树,成段增减,区间求和,注意延迟标记需要累加,还有会爆intAC代码:#include #include #include #include #include #include #include #include #include #include #include #原创 2015-05-14 22:13:34 · 819 阅读 · 0 评论 -
POJ - 2828 - Buy Tickets (线段树)
题目传送:Buy Tickets思路:线段树,从后往前依次插入,插入一个更新一次AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #define LL long long原创 2015-05-14 00:13:14 · 793 阅读 · 0 评论 -
POJ - 3667 - Hotel (线段树 - 区间合并)
题目传送:Hotel思路:线段树,区间合并,区间替换,查询最左断点,看胡浩版本的线段树好几天了,今天看这个看了好久,慢慢来吧,具体都写在注释里了AC代码:#include #include #include #include #include #include #include #include #include #include #include原创 2015-05-15 19:06:30 · 1141 阅读 · 0 评论 -
POJ - 3295 - Tautology (构造)
题目传送:Tautology思路:枚举所有变量可能的值(0或1),算出其表达式的值,因为题目是要求是否是永真式,求式子的真值可以用栈来求,栈的话,可以自己构造一个栈,也可以用STL的stackAC代码:#include #include #include #include #include #include #include #include #incl原创 2015-05-06 17:07:31 · 1214 阅读 · 0 评论 -
POJ - 2115 - C Looooops (扩展欧几里得)
C LooooopsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 19826 Accepted: 5299DescriptionA Compiler Mystery: We are given a C-language style for loop原创 2015-07-27 14:02:51 · 750 阅读 · 0 评论 -
POJ - 2478 - Farey Sequence (欧拉函数)
题目传送:Farey SequenceFarey SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13070 Accepted: 5119DescriptionThe Farey Sequence Fn for an原创 2015-07-27 16:16:00 · 505 阅读 · 0 评论 -
POJ - 3264 - Balanced Lineup (线段树)
Balanced LineupTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 39060 Accepted: 18299Case Time Limit: 2000MSDescriptionFor the daily milking, Far原创 2015-07-27 09:42:49 · 641 阅读 · 0 评论 -
POJ - 3984 - 迷宫问题 (DFS)
迷宫问题Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10936 Accepted: 6531Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,原创 2015-07-24 12:57:17 · 1266 阅读 · 0 评论 -
POJ - 2186 - Popular Cows (tarjan)
Popular Cows题目传送:Popular Cows思路:tarjan算法求强连通分量AC代码:#include <map>#include <set>#include <cmath>#include <deque>#include <queue>#include <stack>#include <cstdio>#include <cctype>#include <string原创 2015-08-04 23:54:52 · 599 阅读 · 0 评论 -
POJ - 3660 - Cow Contest (floyd求传递闭包)
Cow Contest题目传送:Cow Contest思路:floyd求传递闭包,即用来判断每一个点是否可以到达另一个点,然后根据该点的可以到达的点的个数和可以被到达的次数之和等于n-1,来判断该点是否已经确定了排名AC代码:#include <map>#include <set>#include <cmath>#include <deque>#include <queue>#includ原创 2015-08-04 22:10:31 · 750 阅读 · 0 评论 -
深搜简单题
城堡问题题目传送:2815:城堡问题AC代码(递归形式的dfs):#include <map>#include <set>#include <cmath>#include <deque>#include <queue>#include <stack>#include <cstdio>#include <cctype>#include <string>#include <vector原创 2015-08-29 08:55:56 · 2348 阅读 · 0 评论 -
广搜简单题
Catch That Cow题目传送:POJ - 3278 - Catch That Cow题解:点击即传送迷宫问题题目传送:POJ - 3984 - 迷宫问题DFS也可以,见另一个题解AC代码(BFS):#include <map>#include <set>#include <cmath>#include <deque>#include <queue>#include <stack>原创 2015-07-31 12:37:05 · 609 阅读 · 0 评论 -
并查集简单题
The Suspects题目传送:POJ-1611-The SuspectsAC代码:#include <map>#include <set>#include <cmath>#include <deque>#include <queue>#include <stack>#include <cstdio>#include <cctype>#include <string>#inclu原创 2015-07-29 23:45:17 · 1070 阅读 · 0 评论 -
DP简单题
The Triangle题目传送:The TriangleTLE代码(递归形式的DP):#include <map>#include <set>#include <cmath>#include <deque>#include <queue>#include <stack>#include <cstdio>#include <cctype>#include <string>#incl原创 2015-07-29 15:30:39 · 629 阅读 · 0 评论 -
POJ - 1195 - Mobile phones (二维线段树)
Mobile phones题目传送:Mobile phonesAC代码:/************************************************ > Auther : zzuspy > Mail : zzuspy@qq.com > Created Time : 2015/8/7 15:24:00*******原创 2015-08-07 17:07:37 · 731 阅读 · 0 评论 -
POJ - 1011 - Sticks (DFS + 剪枝)
题目传送:Sticks思路:DFS + 剪枝AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #define LL long long#define INF 0x7fff原创 2015-05-06 00:40:35 · 774 阅读 · 1 评论 -
POJ - 2182 - Lost Cows (线段树)
题目传送:Lost Cows思路:线段树,从后往前扫描,如果当前数字为n,则表示它是剩余的序列中(包括他自己)顺序后的第n+1个数。找到后删除,借助线段树可以达到快速删除的效果AC代码:#include #include #include #include #include #include #include #include #include #in原创 2015-05-13 00:02:22 · 738 阅读 · 0 评论 -
POJ-2524-Ubiquitous Religions (基本并查集!)
Ubiquitous ReligionsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 25152 Accepted: 12406DescriptionThere are so many different religions in the world原创 2014-11-21 12:16:41 · 875 阅读 · 0 评论 -
POJ - 2253 - Frogger (Dijkstra)
FroggerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 27362 Accepted: 8895DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Sudde原创 2015-02-12 11:32:17 · 598 阅读 · 0 评论 -
POJ - 2481 - Cows (树状数组+排序!!)
CowsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 13304 Accepted: 4407DescriptionFarmer John's cows have discovered that the clover growing along th原创 2014-12-27 15:14:47 · 671 阅读 · 0 评论 -
POJ - 2001 - Shortest Prefixes (字典树!!)
Shortest PrefixesTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 14250 Accepted: 6140DescriptionA prefix of a string is a substring starting at the be原创 2014-12-25 23:47:22 · 533 阅读 · 0 评论 -
POJ - 2352 - Stars (树状数组!!)
StarsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 34244 Accepted: 14926DescriptionAstronomers often examine star maps where stars are represented b原创 2014-12-27 16:04:54 · 744 阅读 · 0 评论 -
POJ - 1488 - TEX Quotes (字符串!)
TEX QuotesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9046 Accepted: 4743DescriptionTEX is a typesetting language developed by Donald Knuth. It ta原创 2014-12-19 12:14:42 · 1169 阅读 · 0 评论 -
POJ - 2965 - The Pilots Brothers' refrigerator (高效贪心!!)
The Pilots Brothers' refrigeratorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 19356 Accepted: 7412 Special JudgeDescriptionThe game “The Pilo原创 2014-12-19 10:46:34 · 1469 阅读 · 0 评论 -
POJ-1611-The Suspects (简单并查集!)
The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 23337 Accepted: 11345DescriptionSevere acute respiratory syndrome (SARS), an atypical pneu原创 2014-11-21 09:10:26 · 2876 阅读 · 2 评论 -
POJ - 3070 - Fibonacci (矩阵快速幂 + 斐波那契数列)
FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10096 Accepted: 7208DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn原创 2015-03-26 23:17:25 · 3946 阅读 · 0 评论 -
POJ - 3481 - Double Queue (STL)
Double QueueTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11133 Accepted: 5056DescriptionThe new founded Balkan Investment Group Bank (BIG-Bank) ope原创 2015-02-11 22:12:10 · 647 阅读 · 0 评论 -
POJ - 1159 - Palindrome (LCS + 优化)
题目传送:Palindrome思路:一看题目思路很清晰,就是求出字符串s和倒转s后的字符串t的最长公共子序列,但是一看空间开销有点大,如果开int就会爆,5000*5000有100MB了,这里可以开short int,差不多正好可以过去,还有一种做法就是弄一个滚动数组,因为求LCS,根据状态转移方程可以知道,只需要前一行和当前行就行了,所以开个2*5005就OK了,具体看代码原创 2015-05-04 21:13:44 · 625 阅读 · 0 评论 -
POJ - 1458 - Common Subsequence (LCS)
题目传送:Common Subsequence思路:LCSAC代码:#include #include #include #include #include #include #include #include #include #include #include #include #define LL long long#define INF原创 2015-05-04 21:52:48 · 588 阅读 · 0 评论 -
POJ - 1080 - Human Gene Functions (LCS的变形)
题目传送:Human Gene Functions思路:LCS的变形,定义状态dp[ i ][ j ]为取字符串s前i个字符字符串t前j个字符所获得的最大值,则可以得到状态转移方程为:dp[ i ][ j ] = max(dp[ i ][ j - 1] + f[ ' - ' ][ t[ j ] ], dp[ i - 1 ][ j ] + f[ s [ i ] ][ ' - ' ],原创 2015-05-04 23:21:59 · 694 阅读 · 0 评论 -
POJ - 2192 - Zipper (简单DP)
题目传送:Zipper思路:设状态DP[i][j]为字符串A前i个字符和B前j个字符能否组成C的前i+j个字符,能则为true,否则falseAC代码:#include #include #include #include #include #include #include #include #include #include #include原创 2015-05-04 00:07:37 · 681 阅读 · 0 评论 -
POJ - 1703 - Find them, Catch them (并查集)
题目传送:Find them, Catch them思路:用一个关系数组记录当前结点与其父亲的关系,0表示同类,1表示不同类AC代码:#include #include #include #include #include #include #include #include #include #include #include #include原创 2015-05-12 00:04:22 · 886 阅读 · 0 评论 -
POJ - 1067 - 取石子游戏 (威佐夫博奕)
题目传送:取石子游戏威佐夫博奕(Wythoff Game):有两堆各若干个物品,两个人轮流从某一堆或同时从两堆中取同样多的物品,规定每次至少取一个,多者不限,最后取光者得胜。这种情况下是颇为复杂的。我们用(ak,bk)(ak ≤ bk ,k=0,1,2,...,n)表示两堆物品的数量并称其为局势,如果甲面对(0,0),那么甲已经输了,这种局势我们称为奇异局势原创 2015-05-02 21:34:27 · 597 阅读 · 0 评论 -
POJ - 2752 - Seek the Name, Seek the Fame (KMP-打印前缀后缀长度)
题目传送:POJ - 2752思路:就是每次都去找当前串的最大相同前缀后缀,找到一个后,令该相同前缀后缀为当前串,再循环调用,注意因为kmp的next函数中的最大相同前缀后缀不包含自身,所以每次都要多输出原串自身长度AC代码:#include #include #include using namespace std;const int maxn = 1000原创 2015-04-24 09:34:40 · 718 阅读 · 0 评论 -
POJ - 2406 - Power Strings (字符串求周期--next函数的妙用)
题目传送:POJ - 2406思路:就是利用kmp中next数组的特性来求最大周期的AC代码:#include #include #include using namespace std;const int maxn = 1000005;char s[maxn];int next[maxn];int main() { while(scanf(原创 2015-04-24 09:10:28 · 723 阅读 · 0 评论