Oulipo [题目链接]Oulipo [题目类型]KMP &题意: 给你两个字符串p和s,求出p在s中出现的次数. &题解: kmpC函数就是解题的,其中也就j=nex[j]难理解一些,j=nex[j]就代表对照的开始,如果j=nex[j]的值是4,就代表从第4个位置开始比较,正如这句话上面的那个j++,你都匹配上了,所以就会有j++,之后便会j大于等于匹配串的长度,这就代表找到了一个和匹配串一样的串,所以ans++,之后再去找该从哪个位置开始匹配 [时间复杂度]\(O(n+m)\) &…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2087 题意:求模式串在主串中出现的次数,与模式串匹配的子串之间不可重叠. 思路:用kmp算法解决,在匹配更新结果后,重新定位模式串时,不可用j = next[j],应该直接让j定位到模式串开头. code: #include <cstdio> #include <cstring> ; char aa[MAXN]; char bb[MAXN]; int next[MAXN]; int l…
POJ 3461 Oulipo(乌力波) Time Limit: 1000MS   Memory Limit: 65536K [Description] [题目描述] The 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: Tou…
HDU 1686 Oulipo / POJ 3461 Oulipo / SCU 2652 Oulipo (字符串匹配,KMP) Description The 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…
Oulipo Problem's Link ---------------------------------------------------------------------------- Mean: 给你一个模式串P和一个母串S,让你统计P串在S串中出现的次数. analyse: 一开始想到的就是使用KMP,就用KMP写了,93ms,挺快的. 我又用AC自动机写了一遍,万万没想到竟然超时了. 后来看别人有用字符串hash写的,于是又用字符串hash写了一遍,代码30+行,而且速度也挺快…
题目:POJ3080 http://poj.org/problem?id=3080 题意:对于输入的文本串,输出最长的公共子串,如果长度相同,输出字典序最小的. 这题数据量很小,用暴力也是16ms,用后缀数组可以到0ms,但我不会XD. 暴力: #include<cstdio> #include<cstring> using namespace std; ][],ans[]; int main(){ int T,n; scanf("%d", &T); w…
  E - Oulipo Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3461 Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a memb…
Oulipo Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23667   Accepted: 9492 Description The 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…
  E - Oulipo Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3461 Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a memb…
2017-08-13 19:31:47 writer:pprp 对kmp算法有了大概的了解以后,虽然还不够深入,但是已经可以写出来代码,(可以说是背会了) 所以这道题就作为一个模板,为大家使用吧. 题目大意:给你一个子串P和一个主串S,求在主串中有多少个子串? 代码如下:(需要注意的点我都标记好了,两个函数可以直接用) #include <iostream> #include <cstdio> #include <cstdlib> #include <cstrin…