上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 19 下一页
摘要: 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 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(193) 评论(0) 推荐(0) 编辑
摘要: (转载自)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 阅读(606) 评论(5) 推荐(0) 编辑
摘要: 最长回文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 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(602) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(148) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 19 下一页