题意:给你一个字符串,寻找前缀和后缀相同的子串(包括原串). 从小到大排列输出其子串的长度 思路:KMP  next 数组应用. 其实就是一个数学推导过程. 首先由next数组 可知s(ab) = s(bd)   此时next[d]=b   而此时 next[b]=f,意味着s(ef)=s(gh) s(gh)属于s(ab)   s(ab)=s(bd);   所以可以推出 s(gh)属于s(bd)    且s(ef)=s(gh)  所以 s(ef)属于s(cd) #include<cstdio>…
http://poj.org/problem?id=2752 Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 14611   Accepted: 7320 Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked…
Seek the Name, Seek the Fame POJ - 2752 http://972169909-qq-com.iteye.com/blog/1071548 (kmp的next的简单应用) 简单来讲,这道题就是要找字符串的所有相同前缀后缀. 第一次找出最大的相同前缀后缀,然后找次大的.次大的相同前缀后缀的前缀一定是在最大相同前缀后缀的前缀的前面取一段,次大的相同前缀后缀的后缀一定是在最大相同前缀后缀的后缀的后面取一段.由于是相同前缀后缀,将后缀的后面取的那一段移到前缀后面去取,问…
题目传送门 /* 题意:求出一个串的前缀与后缀相同的字串的长度 KMP:nex[]就有这样的性质,倒过来输出就行了 */ /************************************************ * Author :Running_Time * Created Time :2015-8-10 11:29:25 * File Name :POJ_2752.cpp ************************************************/ #incl…
Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17898   Accepted: 9197 Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names t…
Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 10204   Accepted: 4921 Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names t…
Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 14106   Accepted: 7018 Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names t…
Seek the Name, Seek the Fame Time Limit: 2000MS        Memory Limit: 65536K Total Submissions: 24000        Accepted: 12525 Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to g…
Seek the Name,Seek the Fame 过了个年,缓了这么多天终于开始刷题了,好颓废~(-.-)~ 我发现在家真的很难去学习,因为你还要陪父母,干活,做家务等等 但是还是不能浪费时间啊,要利用所有的时间去学习啊 [题目链接]Seek the Name,Seek the Fame [题目类型]KMP &题意: 给你一个字符串S.假如为ababcababababcabab 找出这个字符串中所有的前缀等于后缀的子串,输出它们的长度. 第一个为a,最后一个为b,所以1不行. 前两个为ab…
Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 13840   Accepted: 6887 Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names t…