![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM__CMP&&扩展CMP、最小表示法
文章平均质量分 80
wust_zwl
学不死,就往死里学。
展开
-
HDU 1358 Period(KMP算法应用)
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-16 14:56:09 · 277 阅读 · 0 评论 -
ccpc 2017 网络赛 1004 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-20 17:08:11 · 879 阅读 · 2 评论 -
HDU 3374 String Problem (KMP+最小最大表示法)【模板】
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-21 20:11:09 · 246 阅读 · 0 评论 -
HDU 1238 Substrings(KMP+暴力枚举)
You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given strings.原创 2017-08-21 17:04:58 · 220 阅读 · 0 评论 -
POJ 3080 Blue Jeans (KMP+暴力枚举)【模板】
The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated. As an IBM researcher, you have been tasked with writing原创 2017-08-16 21:20:03 · 1205 阅读 · 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 15:01:49 · 197 阅读 · 0 评论 -
字符串 最小表示法 O(n)算法 【模板】
Some time the programmers have very strange ways to hide their passwords. See for example how Billy "Hacker" Geits hide his password. Billy chooses a string S composed of small Latin letters with length L. Then he makes all L-1 one-letter left cyclic shift原创 2017-08-21 09:35:19 · 349 阅读 · 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-19 21:11:27 · 393 阅读 · 0 评论 -
HUST 1010 The Minimum Length (裸KMP)【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-07-17 21:04:05 · 235 阅读 · 0 评论 -
HDU 3336 Count the string(深入理解KMP算法)【模板】
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-18 16:43:31 · 484 阅读 · 1 评论 -
POJ 2752 Seek the Name, Seek the Fame (KMP)
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-16 17:21:10 · 373 阅读 · 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-07-17 20:38:07 · 190 阅读 · 0 评论 -
字符串 最小表示法 O(n)算法
求字符串的循环最小表示: 上面说的两个字符串同构的,并没有直接先求出Min(s),而是通过指针移动,当某次匹配串长时,那个位置就是Min(s)。而这里的问题就是:不是给定两个串,而是给出一个串,求它的Min(s),eg:Min(“babba”) = 4。那么由于这里并非要求两个串的同构,而是直接求它的最小表示,由于源串和目标串相同,所以处理起来既容易又需要有一些变化:我们仍然设置两原创 2017-08-20 21:08:34 · 233 阅读 · 0 评论