Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 11831   Accepted: 5796 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 : 4000/2000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 12   Accepted Submission(s) : 7 Problem Description The little cat is so famous, that many couples tramp over hill an…
题意:给一个字符串s,问s的某个前缀与后缀相同的情况时,长度是多少. 此题使用KMP的next数组解决. next数组中,j=next[i],next[i]表示S[0...i-1]的某个后缀(字符串S[i-j,i-1])与字符串S[0...j-1]完全相同,此时的j即该段字符串的长度. 字符串s本身是最长的串,next[L]对应的S[0...next[L]]是次长的符合条件的串,其他更短的串怎么求呢. 由于字符串S[L-j...L-1]等于S[0...j-1],这样在S[0...j-1]时继续利…
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 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…
Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 24077   Accepted: 12558 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…
POJ-2184 [题意]: 有n头牛,每头牛有自己的聪明值和幽默值,选出几头牛使得选出牛的聪明值总和大于0.幽默值总和大于0,求聪明值和幽默值总和相加最大为多少. [分析]:变种的01背包,可以把幽默度看成体积,智商看成价值,那么就转换成求体积和价值都为正值的最大值的01背包了. 以 TS 作为体积,TF作为价值,在保证体积.价值非负的情况下,求解 sum,取其所有情况的最大值. 难点: 1)体积出现负数,将区间改变 [-100000, 100000] ---> [0, 200000]. (注…
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 to their newly-born babies. They seek the name, and at the same time seek the fame. In order to escape from such b…
题目链接:http://poj.org/problem?id=2752 题目大意:给你一串字符串s找到所有的公共前后缀,即既是前缀又是后缀的子串. 解题思路: 如图所示 假设字符串pi与jq为符合条件的一组公共前后缀,那么易得pi=jq,如下图所示 若在字符串pi内,pk1与k2i为公共前后缀,有因为pi=jq所以对应的k2i在字符串jq内有后缀k4q与其等价.所以pi内的公共前后缀等也是pq的公共前后缀,而i=next[q],显然是个递归. 所以,可以通过不断使pos=next[pos]进行递…
传送门 http://poj.org/problem?id=2752 题目大意:求既是前缀又是后缀的前缀的可能的长度.. 同样是KMP,和 HDU 2594 Simpsons' Hidden Talents   (   http://blog.csdn.net/murmured/article/details/12867995) 一样,只不过这题是全部输出而已. 故利用失配函数性质,一路next(好吧我的代码是f),最后倒序输出 #include<cstdio> #include<cst…