摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
(转载自)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为中心的回文串长度是一样的. 进一步解释就是 阅读全文
摘要:
最长回文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之间由空行隔开(该空行不用处理 阅读全文
摘要:
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 阅读全文