随笔分类 -  KMP

HDU 4763 Theme Section (2013长春网络赛1005,KMP)
摘要:Theme SectionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 271Accepted Submission(s): 121Problem DescriptionIt's time for music! A lot of popular musicians are invited to join us in the music festival. Each of them will play one of their repr 阅读全文

posted @ 2013-09-29 19:00 kuangbin 阅读(1955) 评论(0) 推荐(0)

POJ 2185 Milking Grid(KMP)
摘要:Milking GridTime Limit:3000MSMemory Limit:65536KTotal Submissions:4738Accepted:1978DescriptionEvery morning when they are milked, the Farmer John's cows form a rectangular grid that is R (1 #include #include #include #include using namespace std;char str[10010][100];int R,C;bool same1(int i,int 阅读全文

posted @ 2013-06-25 09:53 kuangbin 阅读(1095) 评论(0) 推荐(0)

HDU 2594 Simpsons’ Hidden Talents(简单KMP)
摘要:Simpsons’ Hidden TalentsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 939Accepted Submission(s): 321Problem DescriptionHomer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had.Marge: Yeah, what is it?Homer: T 阅读全文

posted @ 2012-08-30 14:13 kuangbin 阅读(1175) 评论(0) 推荐(0)

HDU 3746 Cyclic Nacklace(KMP求循环节)
摘要:Cyclic NacklaceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1255Accepted Submission(s): 538Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are on 阅读全文

posted @ 2012-08-30 12:01 kuangbin 阅读(2643) 评论(1) 推荐(0)

HDU 3336 Count the string(KMP)
摘要:Count the stringTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2191Accepted Submission(s): 1038Problem DescriptionIt is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write dow 阅读全文

posted @ 2012-08-30 11:54 kuangbin 阅读(1199) 评论(0) 推荐(0)

HDU 4300 Clairewd’s message(扩展KMP)
摘要:Clairewd’s messageTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1611Accepted Submission(s): 633Problem DescriptionClairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing f 阅读全文

posted @ 2012-08-27 22:06 kuangbin 阅读(2761) 评论(0) 推荐(0)

KMP算法
摘要:假设主串:S: S[1] S[2] S[3] ……S[n]模式串:T: T[1] T[2] T[3]…..T[m]现在我们假设主串第i 个字符与模式串的第j(j<=m)个字符‘失配’后,主串第i 个字符与模式串的第k(k<j)个字符继续比较,此时就有S[i] != T[j]主串: S[1]...S[i-j+1]...S[i-1]S[i]... ||(匹配) || ≠模式串: T[1]... T[j-1] T[j]由此,可以得到关系式如下 T[1]T[2]T[3]...T[j-1] = S[i-j+1]...S[i-1]由于S[i] != T[j],接下来S[i]将与T[k]继续比较 阅读全文

posted @ 2012-08-14 20:33 kuangbin 阅读(11617) 评论(0) 推荐(2)

POJ 2406 Power Strings(KMP next[]函数)
摘要:Power StringsTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 23112Accepted: 9691DescriptionGiven 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 multiplica 阅读全文

posted @ 2012-08-06 22:09 kuangbin 阅读(591) 评论(0) 推荐(0)

POJ 1961 Period(KMP求一个串的重复子串)
摘要:PeriodTime Limit: 3000MSMemory Limit: 30000KTotal Submissions: 9696Accepted: 4428DescriptionFor each prefix of a given string S with N characters (eac... 阅读全文

posted @ 2012-08-06 21:46 kuangbin 阅读(2490) 评论(1) 推荐(0)

HDU 1711 Number Sequence (KMP找子串第一次出现的位置)
摘要:Number SequenceTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5898Accepted Submission(s): 2652Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 100 阅读全文

posted @ 2012-08-06 21:17 kuangbin 阅读(770) 评论(0) 推荐(0)

POJ 3461 Oulipo(KMP统计子串出现次数)
摘要:OulipoTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12818Accepted: 5128DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout s’a 阅读全文

posted @ 2012-08-06 21:15 kuangbin 阅读(2614) 评论(0) 推荐(0)

导航

JAVASCRIPT: