Power Strings poj2406(神代码)
摘要:Power StringsTime Limit:3000MSMemory Limit:65536KTotal Submissions:29402Accepted:12296DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplicatio
阅读全文
posted @
2014-03-12 22:01
ERKE
阅读(199)
推荐(0)
Palindrome poj3974
摘要:PalindromeTime Limit:15000MSMemory Limit:65536KTotal Submissions:3280Accepted:1188DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the length of the large
阅读全文
posted @
2014-03-12 21:10
ERKE
阅读(203)
推荐(0)
Manacher’s Algorithm (神啊)
摘要:(转载自)http://blog.csdn.net/hopeztm/article/details/7932245这里描述了一个叫Manacher’sAlgorithm的算法。算法首先将输入字符串S, 转换成一个特殊字符串T,转换的原则就是将S的开头结尾以及每两个相邻的字符之间加入一个特殊的字符,例如#例如: S = “abaaba”, T = “#a#b#a#a#b#a#”.为了找到最长的回文字串,例如我们当前考虑以Ti为回文串中间的元素,如果要找到最长回文字串,我们要从当前的Ti扩展使得Ti-d… Ti+d组成最长回文字串. 这里d其实和 以Ti为中心的回文串长度是一样的. 进一步解释就是
阅读全文
posted @
2014-03-12 21:09
ERKE
阅读(625)
推荐(0)
最长回文 hdu3068(神代码)
摘要:最长回文Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6629Accepted Submission(s): 2284Problem Description给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开(该空行不用处理
阅读全文
posted @
2014-03-12 20:23
ERKE
阅读(404)
推荐(0)
1297. Palindrome ural1297(后缀数组)
摘要:1297. PalindromeTime limit: 1.0 secondMemory limit: 64 MBThe “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. Robots» security service would have alrea
阅读全文
posted @
2014-03-12 16:30
ERKE
阅读(246)
推荐(0)
705. New Distinct Substrings spoj(后缀数组求所有不同子串)
摘要:705. New Distinct SubstringsProblem code: SUBST1Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. T 2 #include 3 #include 4 using namespace std; 5 #define N 51000 6 char a[N]; 7 int c[N],d[N],e[N],sa[N],height[N],n,b[N],m; 8 int cmp(int *r,in..
阅读全文
posted @
2014-03-11 23:55
ERKE
阅读(248)
推荐(0)
Milk Patterns poj3261(后缀数组)
摘要:Milk PatternsTime Limit:5000MSMemory Limit:65536KTotal Submissions:9274Accepted:4173Case Time Limit:2000MSDescriptionFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality of mi
阅读全文
posted @
2014-03-11 13:57
ERKE
阅读(234)
推荐(0)
Musical Theme poj1743(后缀数组)
摘要:Musical ThemeTime Limit:1000MSMemory Limit:30000KTotal Submissions:16757Accepted:5739DescriptionA musical melody is represented as a sequence of N (1 2 #include 3 #include 4 using namespace std; 5 #define N 20001 6 int a[N],c[N],d[N],e[N],sa[N],height[N],n,b[N],m; 7 int cmp(int *r,int a,int b,int ..
阅读全文
posted @
2014-03-11 13:50
ERKE
阅读(228)
推荐(0)
Conscription poj3723(最大生成树)
摘要:ConscriptionTime Limit:1000MSMemory Limit:65536KTotal Submissions:6870Accepted:2361DescriptionWindy has a country, and he wants to build an army to protect his country. He has picked upNgirls andMboys and wants to collect them to be his soldiers. To collect a soldier without any privilege, he must p
阅读全文
posted @
2014-03-09 09:47
ERKE
阅读(609)
推荐(0)
Drying poj3104(二分)
摘要:DryingTime Limit:2000MSMemory Limit:65536KTotal Submissions:7916Accepted:2006DescriptionIt is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is not afraid of this boring process. Jane has decided to use a radiator to make drying faster. But the radiator
阅读全文
posted @
2014-03-08 22:43
ERKE
阅读(158)
推荐(0)
Finding LCM (最小公倍数)
摘要:Finding LCMTime Limit:2000MSMemory Limit:32768KB64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionLCMis an abbreviation used forLeastCommonMultiple in Mathematics. We sayLCM (a, b, c) = Lif and only ifLis the least integer which is divisible bya, bandc.You will be givena, bandL. Y
阅读全文
posted @
2014-03-08 21:24
ERKE
阅读(351)
推荐(0)
Dice (II) (DP)唉,当时没做出来
摘要:Dice (II)Time Limit:3000MSMemory Limit:32768KB64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionYou haveNdices; each of them hasKfaces numbered from1toK. Now you can arrange theNdices in a line. If the summation of the top faces of the dices isS, you calculate the score as the mul
阅读全文
posted @
2014-03-08 21:05
ERKE
阅读(310)
推荐(0)
D. Mysterious Present (看到的一个神奇的DP,也可以说是dfs)
摘要:D. Mysterious Presenttime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputPeter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make achain. Chain here is such a sequen
阅读全文
posted @
2014-03-07 20:52
ERKE
阅读(308)
推荐(0)
Corn Fields poj3254(状态压缩DP)
摘要:Corn FieldsTime Limit:2000MSMemory Limit:65536KTotal Submissions:6081Accepted:3226DescriptionFarmer John has purchased a lush new rectangular pasture composed ofMbyN(1 ≤M≤ 12; 1 ≤N≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, some of the squ
阅读全文
posted @
2014-03-06 19:28
ERKE
阅读(222)
推荐(0)
Suneast & Daxia (规律)
摘要:Suneast & DaxiaTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64u[Submit] [Go Back] [Status]DescriptionDaxia is so cute that people loves it so much.Everyone wants to buy Daxia from Suneast (a business man who sells Daxia).Suneast is a strange business man. He sells Daxia in
阅读全文
posted @
2014-03-05 13:20
ERKE
阅读(247)
推荐(0)
Coin Change (IV) (dfs)
摘要:Coin Change (IV)Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionGivenncoins, values of them areA1, A2... Anrespectively, you have to find whether you can payKusing the coins. You can use any coin at most two times.InputInput starts with an in
阅读全文
posted @
2014-03-05 13:16
ERKE
阅读(270)
推荐(0)
2013 ACM/ICPC Asia Regional Chengdu Online hdu4731 Minimum palindrome
摘要:Minimum palindromeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 309Accepted Submission(s): 150 Problem DescriptionSetting password is very important, especially when you have so many "interesting" things in "F:\TDDOWNLOAD". W
阅读全文
posted @
2013-09-15 20:57
ERKE
阅读(340)
推荐(0)
2013 ACM/ICPC Asia Regional Hangzhou Online hdu4739 Zhuge Liang's Mines
摘要:Zhuge Liang's MinesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 44Accepted Submission(s): 9 Problem DescriptionIn the ancient three kingdom period, Zhuge Liang was the most famous and smartest military leader. His enemy was Shima Yi, who al
阅读全文
posted @
2013-09-15 18:00
ERKE
阅读(384)
推荐(0)
hdu3065 ac自动机
摘要:病毒侵袭持续中Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4809Accepted Submission(s): 1698 Problem Description小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打
阅读全文
posted @
2013-08-23 22:33
ERKE
阅读(260)
推荐(0)
hdu3695 ac自动机入门
摘要:Computer Virus on Planet PandoraTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 256000/128000 K (Java/Others) Total Submission(s): 1846Accepted Submission(s): 510 Problem DescriptionAliens on planet Pandora also write computer programs like us. Their programs only consist of capital letters (‘A’
阅读全文
posted @
2013-08-23 19:43
ERKE
阅读(230)
推荐(0)