![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
POJ
文章平均质量分 80
GKHack
这个作者很懒,什么都没留下…
展开
-
POJ3249 Test for Job(拓扑排序+dp)
Test for JobTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 10137 Accepted: 2348DescriptionMr.Dog was fired by his company. In order to support his原创 2015-12-08 20:09:10 · 1589 阅读 · 0 评论 -
POJ1321 棋盘问题(dfs)
Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n原创 2015-08-05 15:18:57 · 941 阅读 · 0 评论 -
POJ2945 Find the Clones(暴力 & 字典树)
Find the ClonesTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 7501 Accepted: 2782DescriptionDoubleville, a small town in Texas, was attacked by the a原创 2015-08-15 10:15:14 · 1040 阅读 · 0 评论 -
POJ3660 Cow Contest(floyd)
DescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill ra原创 2015-08-09 15:25:38 · 928 阅读 · 0 评论 -
POJ3262 Protecting the Flowers(贪心)
Protecting the FlowersTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 4968 Accepted: 1985DescriptionFarmer John went to cut some wood and left N (2 ≤ N原创 2015-06-04 10:30:01 · 1173 阅读 · 0 评论 -
POJ1182 食物链(并查集)
Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物原创 2015-08-09 15:42:38 · 742 阅读 · 0 评论 -
POJ1751 Highways(kru)
HighwaysTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11163 Accepted: 3174 Special JudgeDescriptionThe island nation of Flatopia is perfectly fl原创 2015-08-18 10:29:16 · 936 阅读 · 0 评论 -
POJ2362 Square(dfs)
DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square?InputThe first line of input contains N, the number of test cases. Each test case原创 2015-08-05 09:08:40 · 841 阅读 · 0 评论 -
POJ1789 Truck History(kru, prim)
DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing ea原创 2015-08-10 09:50:31 · 1093 阅读 · 0 评论 -
POJ3126 Prime Path(bfs)
DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It i原创 2015-08-12 09:25:03 · 1031 阅读 · 0 评论 -
POJ2251 Dungeon Master(bfs)
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one un原创 2015-08-12 09:44:42 · 952 阅读 · 0 评论 -
POJ3069 Saruman's Army(贪心)
DescriptionSaruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes seeing stones, known as palantirs, among the原创 2015-08-02 19:15:53 · 926 阅读 · 0 评论 -
POJ2406 Power Strings(kmp)
题目链接:点击打开链接给你一个字符串,问你子串出现最多次数是多少。利用nxt数组性质,若len % (len - nxt[len]) == 0,则子串最多出现len / (len - nxt[len])次。否则没有重复出现的子串。AC代码:#include "iostream"#include "cstdio"#include "cstring"#includ原创 2015-10-08 01:24:05 · 102 阅读 · 0 评论 -
POJ2752 Seek the Name, Seek the Fame(kmp)
题目链接:点击打开链接给你一个字符串,要你从小到大输出重复子串的长度。利用nxt数组性质,将长度从大到小保存到ans数组中,最后逆序输出答案。AC代码:#include "iostream"#include "cstdio"#include "cstring"#include "algorithm"using namespace std;const int原创 2015-10-08 01:28:22 · 835 阅读 · 0 评论 -
POJ3764 The xor-longest Path(字典树)
The xor-longest PathTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 4946 Accepted: 1076DescriptionIn an edge-weighted tree, the xor-length of a path原创 2015-11-17 10:35:32 · 1229 阅读 · 0 评论 -
POJ3630 Phone List(字典树)
Phone ListTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 25813 Accepted: 7804DescriptionGiven a list of phone numbers, determine if it is consisten原创 2015-11-17 09:54:18 · 1104 阅读 · 0 评论 -
POJ3349 Snowflake Snow Snowflakes(hash)
Snowflake Snow SnowflakesTime Limit: 4000MS Memory Limit: 65536KTotal Submissions: 35715 Accepted: 9399DescriptionYou may have heard that no two snowflakes ar原创 2015-11-17 11:20:44 · 866 阅读 · 0 评论 -
POJ1251 Jungle Roads(kru)
题目链接:点击打开链接给出n - 1组边长, 构成一张图, 要求删除一些边使得边长和最小且任意两点可到达.最小生成树, 套一个kru模板即可. 并查集初始化, 读入数据后对边长进行排序, 若并查集确定两点不在同一连通分量则将两点连接并存储所得到的边.AC代码:#include "iostream"#include "cstdio"#include "cstring"原创 2015-11-17 09:04:25 · 994 阅读 · 0 评论 -
POJ3067 Japan(树状数组)
JapanTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 23641 Accepted: 6384DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of road原创 2015-09-02 18:13:26 · 855 阅读 · 0 评论 -
POJ3974 Palindrome(Manacher)
题目链接:点击打开链接给你一个字符串, 让你输出最长回文的长度.Manacher模板题, 最长长度为p[i] - 1.AC代码:#include "iostream"#include "cstdio"#include "cstring"#include "algorithm"using namespace std;const int MAXN = 1e6 + 10原创 2015-10-23 00:28:47 · 1000 阅读 · 0 评论 -
POJ2185 Milking Grid(kmp)
题目链接:点击打开链接给你一个字符串矩阵,问你最小覆盖矩阵的面积是多少。对每一行求最小覆盖子串的长度,对长度求最小公倍数,获得最小覆盖矩阵的长。同理,可以获得最小矩阵的宽。如果长或宽大于给定矩阵的长或宽,那么所求最小覆盖矩阵的长或宽即为原矩阵的长或宽。AC代码:#include "iostream"#include "cstdio"#include "cst原创 2015-10-08 17:41:18 · 785 阅读 · 0 评论 -
POJ1062 昂贵的聘礼(dijkstra)
题目链接:点击打开链接读入数据后,扫一遍物品,每一遍都根据等级关系标记这个物品是否可以使用,进行一次dijkstra,求出最小花费金币数。AC代码:#include "iostream"#include "cstdio"#include "cstring"#include "algorithm"using namespace std;const int INF原创 2015-10-08 07:39:08 · 948 阅读 · 0 评论 -
POJ3461 Oulipo(kmp)
题目链接:点击打开链接给你两个字符串,问你前一个字符串在后一个字符串中出现了几次。简单修改hdoj2087代码即可ac,就是交换了一下输入顺序,以及此题kmp()函数中j不归零。AC代码:#include "iostream"#include "cstdio"#include "cstring"#include "algorithm"using namesp原创 2015-10-08 01:32:04 · 987 阅读 · 0 评论 -
POJ3080 Blue Jeans(kmp & 暴力)
题目链接:点击打开链接给你m个字符串,问你最长公共子序列是什么,若长度小于3输出给定字符串,若存在多个最长公共子序列,输出字典序最小的。kmp:从开头到结尾遍历字符串,每一个新的字符串开头都进行一次kmp,得到长度后跟原先得出的比较,长度长则直接更新,长度相等则比较字典序。AC代码:#include "iostream"#include "cstdio"#i原创 2015-10-08 22:00:28 · 1166 阅读 · 0 评论 -
POJ1426 Find The Multiple(bfs)
DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater tha原创 2015-08-12 09:57:27 · 911 阅读 · 0 评论 -
POJ2456 Aggressive cows(对整数二分)
DescriptionFarmer John has built a new long barn, with N (2 His C (2 <= C <= N) cows don't like this barn layout and become aggressive towards each other once put into a stall. To prevent the原创 2015-08-02 19:25:55 · 635 阅读 · 0 评论 -
POJ2299 Ultra-QuickSort(树状数组)
Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 49181 Accepted: 17995DescriptionIn this problem, you have to analyze a particular sorti原创 2015-09-02 00:12:58 · 886 阅读 · 0 评论 -
POJ1368 & HDOJ1116 Play on Words(欧拉回路 + 并查集)
Play on WordsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10844 Accepted: 3695DescriptionSome of the secret doors contain a very interesting word p原创 2015-09-04 22:34:18 · 1253 阅读 · 0 评论 -
POJ2230 Watchcow(欧拉回路 + dfs)
WatchcowTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 6493 Accepted: 2829 Special JudgeDescriptionBessie's been appointed the new watch-cow for原创 2015-09-05 09:04:33 · 1055 阅读 · 0 评论 -
POJ2309 BST(树状数组)
BSTTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9098 Accepted: 5552DescriptionConsider an infinite full binary search tree (see the figure below),原创 2015-09-03 15:41:10 · 1073 阅读 · 0 评论 -
POJ1041 John's trip(欧拉回路 + 并查集 + dfs)
John's tripTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7856 Accepted: 2644 Special JudgeDescriptionLittle Johnny has got a new car. He decided原创 2015-09-04 16:06:28 · 1120 阅读 · 0 评论 -
POJ1363 Rails(栈)
题目链接:点击打开链接给你一个n,接下来一行是n个数字,代表出火车站的顺序,进火车站的顺序是1-n,问你是否可以按照给定的顺序出火车站。火车站好比一个栈,火车进站代表入栈,火车出站代表出栈,可以模拟这个过程来判断是否符合题意。不用stack的写法: 对读入数据后的for循环进行分析,每一个cnt代表是火车的序号,火车每出站和入站匹配时就匹配下一原创 2015-09-25 22:14:33 · 1329 阅读 · 0 评论 -
POJ1111 Image Perimeters(dfs)
Image PerimetersTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8400 Accepted: 5030DescriptionTechnicians in a pathology lab analyze digitized images原创 2015-09-10 06:55:06 · 1051 阅读 · 0 评论 -
POJ2352 Stars(线段树 & 树状数组)
StarsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 37709 Accepted: 16423DescriptionAstronomers often examine star maps where stars are represented b原创 2015-08-31 17:41:49 · 949 阅读 · 0 评论 -
POJ2676 Sudoku(dfs)
SudokuTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 16161 Accepted: 7894 Special JudgeDescriptionSudoku is a very simple task. A square table wi原创 2015-09-09 16:56:44 · 1021 阅读 · 0 评论 -
POJ3268 Silver Cow Party(dijkstra)
Silver Cow PartyTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 15644 Accepted: 7106DescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) convenientl原创 2015-08-31 20:13:00 · 1150 阅读 · 0 评论 -
POJ2481 Cows(线段树 & 树状数组)
CowsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 14777 Accepted: 4890DescriptionFarmer John's cows have discovered that the clover growing along th原创 2015-09-01 17:30:29 · 122 阅读 · 0 评论 -
POJ2155 Matrix(树状数组)
MatrixTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 21448 Accepted: 8016DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j]原创 2015-09-01 10:47:18 · 819 阅读 · 0 评论 -
POJ1195 Mobile phones(树状数组)
Mobile phonesTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 16729 Accepted: 7698DescriptionSuppose that the fourth generation mobile phone base stati原创 2015-09-01 08:25:38 · 793 阅读 · 0 评论 -
POJ2488 A Knight's Journey(dfs)
DescriptionBackground The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is原创 2015-08-05 15:11:28 · 924 阅读 · 0 评论