
KMP算法
bupt_xycr
欢迎关注我的公众号:算法入门
熟悉
c++
caffe
pytorch
mxnet
tensorflow
深度学习
自动驾驶
点云
图像处理
编程比赛
python
java
展开
-
KMP 算法模板
/*kmp 模板 2014年10月18日*/#includeusing namespace std;int f[100];void getFail(char* p, int* f)//预处理子串{ int m = strlen(p); f[0] = 0; f[1] = 0; for (int i = 1; i { int j = f[i]; while (j && p[i] != p[j])原创 2016-04-21 19:04:12 · 401 阅读 · 0 评论 -
POJ 2752 Seek the Name, Seek the Fame
http://poj.org/problem?id=2752这道题目的大意是:给你一个字符串,求他的前缀和后缀相等时的长度例如 字符串alala :有 a=a ala=ala alala=alala三种情况。答案是1 3 5 解题思路KMP的next数组。就如题目中的例子原串=ababcababababcabab,next=0 1 1 2 3 1 2 3 4 5 4 5 4 5 6 7 8原创 2016-04-21 19:04:10 · 335 阅读 · 0 评论 -
POJ 3461 Oulipo
http://poj.org/problem?id=3461题目大意是求子串在主串中出现的次数;#include#include#include#include#include#include#include#include#include#include#include#include #include #define maxn 10000+5#define ull unsigned long原创 2016-04-21 19:04:07 · 309 阅读 · 0 评论 -
HDU3336Count the string
http://acm.hdu.edu.cn/showproblem.php?pid=3336Count the stringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5060 Accepted Submission(s): 23原创 2016-04-21 18:57:40 · 275 阅读 · 0 评论 -
HDU1686Oulipo
http://acm.hdu.edu.cn/showproblem.php?pid=1686OulipoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5535 Accepted Submission(s): 2211Problem原创 2016-04-21 18:57:38 · 225 阅读 · 0 评论 -
HDU 2594
http://acm.hdu.edu.cn/showproblem.php?pid=2594Simpsons’ Hidden TalentsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3323 Accepted Submissio原创 2016-04-21 18:57:35 · 391 阅读 · 0 评论 -
hiho #1015 : KMP算法
http://hihocoder.com/problemset/problem/1015kmp基础题#include#include#include#include#include#include#include#include#include#include#include#include #include #define maxn 10000+5#define ull unsigned lon原创 2016-04-21 18:55:43 · 234 阅读 · 0 评论