
KMP算法
文章平均质量分 81
i-unique
擅长各种姿势划水
展开
-
KMP算法入门详解
通俗易懂的KMP详解转载 2017-08-20 15:02:19 · 350 阅读 · 0 评论 -
模板总结
属于自己的模板。。。比赛防忘记赛前复习向原创 2017-07-24 10:25:30 · 1561 阅读 · 1 评论 -
HDU 3613 Best Reward(扩展KMP模板)
After an uphill battle, General Li won a great victory. Now the head of state decide to reward him with honor and treasures for his great exploit. One of these treasures is a necklace made up of 26 different kinds of gemstones, and the length of the neck原创 2017-08-28 14:27:04 · 270 阅读 · 0 评论 -
HDU 6153 A Secret(扩展KMP+数学推导)
Today is the birthday of SF,so VS gives two strings S1,S2 to SF as a present,which have a big secret.SF is interested in this secret and ask VS how to get it.There are the things that VS tell: Suffix(S2,i) = S2[i...len].Ni is the times that Suffix(S2,i)原创 2017-08-28 15:24:38 · 319 阅读 · 0 评论 -
HDU 3374 String Problem(最大最小表示法模板+KMP+next数组的运用)
Give you a string with length N, you can generate N strings by left shifts. For example let consider the string “SKYLONG”, we can generate seven strings: String Rank SKYLONG 1 KYLONGS 2 YLONGSK 3 LONGSKY 4 ONGSKYL 5 NGSKYLO 6 GSKYLON 7 and lexicog原创 2017-08-23 15:27:26 · 568 阅读 · 0 评论 -
FZU 1901 Period II(KMP)
For each prefix with length P of a given string S,ifS[i]=S[i+P] for i in [0..SIZE(S)-p-1],then the prefix is a “period” of S. We want to all the periodic prefixs.原创 2017-08-24 09:22:06 · 362 阅读 · 1 评论 -
HDU 2328 Corporate Identity(发现新大陆之KMP专题不用KMP也能过系列)
Beside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Internet Building Masters (IBM), which has recently asked ACM for a help wit原创 2017-08-23 10:56:31 · 424 阅读 · 0 评论 -
HDU 4300 Clairewd’s message(扩展KMP)
Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing for sending it to ykwd. They had agreed that each letter of these messages would be transfered to another one according to a原创 2017-08-21 20:57:33 · 325 阅读 · 0 评论 -
HDU 2594 Simpsons’ Hidden Talents(KMP)
Homer: 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: Take me for example. I want to find out if I have a talent in politics, OK? Marge: OK. Homer: So I take some politician’s na原创 2017-08-21 19:09:27 · 249 阅读 · 0 评论 -
HDU 3336 Count the string(KMP+稍微DP+next数组的运用)
It 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 string. For example: s: "abab" The prefixes are: "a", "ab", "aba", "abab" For each原创 2017-08-21 19:28:16 · 256 阅读 · 0 评论 -
POJ 2752 Seek the Name, Seek the Fame(KMP+next数组的运用)
The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek the fame. In order to escape from such boring job, the inn原创 2017-08-21 15:32:08 · 324 阅读 · 0 评论 -
POJ 2406 Power Strings(KMP+最小循环节)
Given 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 multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = ""原创 2017-08-21 15:14:33 · 336 阅读 · 0 评论 -
HUST 1010 The Minimum Length(KMP)
There is a string A. The length of A is less than 1,000,000. I rewrite it again and again. Then I got a new string: AAAAAA...... Now I cut it from two different position and get a new string B. Then, give you the string B, can you tell me the length of the原创 2017-08-21 14:30:02 · 291 阅读 · 0 评论 -
HDU 3746 Cyclic Nacklace(KMP)
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to tide over the last days. Being inspired by the entrepre原创 2017-08-21 10:04:44 · 274 阅读 · 0 评论 -
HDU 1358 Period(KMP+next数组的运用)
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 <= i <= N) we want to know the largest K > 1 (if there i原创 2017-08-21 11:12:58 · 248 阅读 · 0 评论 -
HDU 5510 Bazinga(KMP||strstr神器+些许优化)
Ladies and gentlemen, please sit up straight. Don't tilt your head. I'm serious.For nn given strings S1,S2,⋯,SnS1,S2,⋯,Sn, labelled from 11 to nn, you should find the largest i (1≤i≤n)i (1≤i≤n) such that there exists an integer j (1≤j<i)j (1≤j<i) and SjS原创 2017-09-26 21:22:26 · 616 阅读 · 0 评论