参考资料:http://wenku.baidu.com/view/8e9ebefb0242a8956bece4b3.html(扩展kmp)http://blog.csdn.net/yutianzuijin/article/details/11954939(kmp详解)http://www.cnblo...
分类:
其他好文 时间:
2015-08-31 19:30:06
阅读次数:
122
Revolving Digits Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=4333 Mean:给你一个字符串,你可以将该字符串的任意长度后缀截取下来然后接到最前面,让你统计所有新串中有多少种字典序小于、等于、大...
分类:
其他好文 时间:
2015-08-25 23:40:47
阅读次数:
268
题意:真难懂。。给出26个英文字母的加密表,明文中的'a'会转为加密表中的第一个字母,'b'转为第二个,...依次类推。然后第二行是一个字符串(str1),形式是密文+明文,其中密文一定完整,而明文可能不完整(也可能没有)。求出最短的完整的字符串(密文+明文)。思路:1.用kmp来做:首先肯定的是,...
分类:
其他好文 时间:
2015-08-21 19:02:01
阅读次数:
135
扩展KMP的简单题。#include#include#define maxn 51010char s[maxn],t[maxn];int extand[maxn],next[maxn];void getnext(char *t){ int i,k,j,len=strlen(t); nex...
分类:
其他好文 时间:
2015-08-18 08:58:40
阅读次数:
120
#include#include#define maxn 501000char s[maxn],t[maxn];int next[maxn],extand1[maxn],extand2[maxn];int ans[30],sum[maxn];void getnext(int *next,char *...
分类:
其他好文 时间:
2015-08-15 14:52:29
阅读次数:
210
慢慢研究可以发现,可以用扩展kmp来求。由于扩展kmp的next[]只有一部分,当前位子前面那部分和母串的后部分,所以可以将字符串复制接在后面一次。先求如果next[]>0&&next[]!=len,那么只要考虑后面那位的大小比较。如果next[]>=len 那就是相同。如果next[]==0,就是...
分类:
其他好文 时间:
2015-08-13 17:33:04
阅读次数:
140
这题说的是给了一个个数字串 把最低位的移动到最高位 在与原串进行比较大小,问一下有多少大于等于小于, 这些转化后的数字不能相同,相同的只能计算一次,我们通过扩展kmp能计算出所有的大小 但是不能计算出有无重复的 发现只用整个串是循环串的时候才能认为会出现重复的数字 这样我们 使用kmp可以计算出 一...
分类:
其他好文 时间:
2015-08-03 20:43:24
阅读次数:
102
算法可以参考http://wenku.baidu.com/view/8e9ebefb0242a8956bece4b3.html百度文库#include #include using namespace std; const int MM=100005; int next[MM],extand...
分类:
其他好文 时间:
2015-08-02 00:57:09
阅读次数:
222
DescriptionGiven 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...
分类:
其他好文 时间:
2015-07-18 12:30:39
阅读次数:
88
DescriptionFor 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 whe...
分类:
其他好文 时间:
2015-07-18 12:23:05
阅读次数:
91