![](https://img-blog.csdnimg.cn/20190927151124774.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
KMP
KMP
浪漫些许潦草
这个作者很懒,什么都没留下…
展开
-
hdu 1358 Period(KMP之next数组)
PeriodProblem Description 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 strin原创 2017-07-10 10:58:38 · 362 阅读 · 0 评论 -
nyoj 2340 最小循环节(KMP之next数组的应用)
最小循环节题目描述 给定一个字符串S求该字符串的最小循环节长度及最小循环节。 输入 多组输入数据,每组数据输入一个字符串,直到文件结束。 输出 输出一个整数代表这个字符串的最小循环节的长度,输出一串字符串代表最短循环节,中间用空格隔开。样例输入 aaa 样例输出 1 a 提示 题目数据:长度小于1e6.原题链接:最小循环节首先得知道什么是最小循环节 kmp的next数组里存的是原创 2017-07-10 10:35:43 · 491 阅读 · 0 评论 -
poj 2752 Seek the Name, Seek the Fame(KMP应用)
Seek the Name, Seek the FameDescriptionThe 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原创 2017-05-22 21:58:09 · 382 阅读 · 0 评论 -
poj 3461 Oulipo(KMP)
DescriptionThe 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原创 2017-05-22 20:32:39 · 388 阅读 · 0 评论 -
hdu 6153 A Secret(kmp||扩展kmp)
A Secret题目链接:A Secret题意:给定两个字符串s1和s2,对于s2的每个后缀,LiLi表示后缀的长度,NiNi表示这个后缀在s1中出现的次数,求∑(Li∗Ni)\sum(Li*Ni)思路:可以先把后缀转换为前缀,然后就是扩展kmp的模板题了。在扩展kmp中,next[i]表示T[i,len_T-1]与T[0,len_T-1]的最长公共前缀, extend表示S[i,len_S-1]原创 2017-09-12 20:31:49 · 418 阅读 · 0 评论