字符串
字符串刷题分类
Suprit
先选择一种经历,经历再造就一个人
展开
-
【题解】吉哥系列故事——完美队形II HDU - 4513 ⭐⭐⭐ 【Manacher】
吉哥系列故事——完美队形II HDU - 4513 吉哥又想出了一个新的完美队形游戏!假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] … h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形:1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的;2、左右对称,假设有m个人形成新的队形,则第1个人和第m个...原创 2019-09-24 16:20:23 · 321 阅读 · 0 评论 -
【题解】Seek the Name, Seek the Fame POJ - 2752 ⭐⭐ 【KMP】
Seek the Name, Seek the Fame POJ - 2752给定若干只含小写字母的字符串(这些字符串总长≤400000),在每个字符串中求出所有既是前缀又是后缀的子串长度。例如:ababcababababcabab,既是前缀又是后缀的子串:ab,abab,ababcabab,ababcababababcabab。Input输入若干行,每行一个字符串。Output对于每...原创 2019-10-09 09:39:49 · 352 阅读 · 0 评论 -
【题解】Oulipo HDU - 1686⭐⭐ 【KMP】
Oulipo HDU - 1686求模式串在待匹配串中的出现次数。Input第一行是一个数字T,表明测试数据组数。之后每组数据都有两行:第一行为模式串,长度不大于10,000;第二行为待匹配串,长度不大于1,000,000。(所有字符串只由大写字母组成)Output每组数据输出一行结果。ExamplesSample Input4ABCDABCDSOSSOSOSOSCD...原创 2019-09-02 14:12:06 · 242 阅读 · 0 评论 -
【题解】Cyclic Nacklace HDU - 3746 ⭐⭐⭐ 【KMP 循环节问题】
Cyclic Nacklace HDU - 3746 第一题来啦。现在给你一个字符串,请问在该字符串末尾最少添加多少个字符,可以让这个字符串获得重复循环序列。Input第一行是一个整数 T ( 0<T<=100 ) 代表测试数据的组数。之后T行每行一个字符串,由小写字母组成,字符串的长度3<=L<=100000。Output每组数据输出一行结果。Exampl...原创 2019-09-04 14:32:30 · 534 阅读 · 0 评论 -
【题解】string matching HDU - 6629 ⭐⭐ 【扩展KMP】
string matching HDU - 6629String matching is a common type of problem in computer science. One string matching problem is as following:Given a string s[0…len−1], please calculate the length of the l...原创 2019-09-05 10:39:25 · 299 阅读 · 0 评论 -
【题解】Power Strings POJ - 2406 ⭐⭐ 【KMP 循环节问题】
Power Strings POJ - 2406 假设s可以由t重复k次拼成,即s=tttt……tt,我们称为s=t^k。 先给定一个字符串s,求最大的n使得存在t满足s=t^n。Input多组数据,每行一个字符串(仅包含可打印字符且长度不超过1000000),以单独一行.作为终结标志Output每组数据一行答案Examplesabcdaaaaababab.Hint14...原创 2019-09-05 10:48:14 · 503 阅读 · 0 评论 -
【题解】Simpsons’ Hidden Talents HDU - 2594⭐⭐ 【扩展KMP】
Simpsons’ Hidden Talents HDU - 2594 求S1的前缀和S2的后缀的《最大》匹配Input多组输入,第一行S1,第二行S2。S1和S2的长度小于50000。Output输出一行。如果没有匹配,那么只输出一个0。反之,输出匹配的字符串和匹配长度。中间一个空格间隔。ExamplesSample Inputclintonhomerriemann...原创 2019-09-05 10:57:12 · 337 阅读 · 0 评论 -
【题解】Count the string HDU - 3336 ⭐⭐⭐ 【KMP】
Count the string HDU - 3336It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this st...原创 2019-09-12 22:30:01 · 509 阅读 · 1 评论 -
【题解】计蒜客 Longest subsequence⭐⭐⭐ 【序列自动机 思维 暴力】
计蒜客 Longest subsequenceString is a very useful thing and a subsequence of the same string is equally important.Now you have a string ss with length nn and a string tt with length mm. Find out the lo...原创 2019-09-13 15:37:38 · 224 阅读 · 0 评论 -
【题解】Substrings HDU - 1238 ⭐⭐⭐ 【KMP 暴力】
Substrings HDU - 1238 给你一个字母组成的字符串,找到这样最长的一个字符串X,它或将它左右颠倒形成的字符串是所给出任何字符串的子串Input第一行给一个整数t (1 <= t <= 10), 代表测试样例数。接下来有t组样例数据,第一行给出一个整数n, (1 <= n <= 100), 表示n个字符串,,接下来有n行,每一行代表一个长度在1和100...原创 2019-09-18 15:56:46 · 375 阅读 · 0 评论 -
【题解】Glass Beads POJ - 1509 ⭐⭐⭐ 【最小表示法】
Glass Beads POJ - 1509Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But she was not interested in the crowd...原创 2019-09-19 14:48:05 · 265 阅读 · 0 评论 -
【题解】How many HDU - 2609 ⭐⭐⭐ 【最小表示法】
How many HDU - 2609The input contains multiple test cases.Each test case include: first one integers n. (2<=n<=10000)Next n lines follow. Each line has a equal length character string. (strin...原创 2019-09-19 15:25:40 · 370 阅读 · 0 评论 -
【题解】MUV LUV EXTRA HDU - 6740 ⭐⭐⭐ 【KMP】
MUV LUV EXTRA HDU - 6740One day, Kagami Sumika is stuck in a math problem aiming at calculating the length of a line segment with given statements and constraints. Since Sumika has no idea about it, ...原创 2019-10-10 10:19:08 · 311 阅读 · 0 评论