kmp
@阿奇@
做一个勤勉、有趣、善良的人
展开
-
poj2406
这题是未优化的next数组的应用#include<iostream> #include <string.h> #include <stdio.h> using namespace std; int next[1000010]; char p[1000010]; int pLen; void GetNext() { pLen = strlen(p); next[0] = -1;原创 2017-12-09 14:35:48 · 146 阅读 · 0 评论 -
poj2752
发现不优化的next数组经常用啊……#include<iostream> #include <string.h> #include <stdio.h> #include <stack> using namespace std; int next[1000010]; char p[1000010]; int pLen;void GetNext() { pLen = strlen(p);原创 2017-12-09 16:13:49 · 244 阅读 · 0 评论 -
poj3167
这道题看别人代码看了一天,我去……功夫不行啊!#include <iostream> #include <stdio.h> #include <vector> #include <string.h>using namespace std; const int maxn=25010; int n,m,s; vector<int> ans; int sum[maxn]; int next[maxn];原创 2017-12-11 12:27:12 · 121 阅读 · 0 评论 -
KMP
KMP详解转载 2017-11-29 08:35:10 · 121 阅读 · 0 评论 -
hdu1711
模板题:#include <iostream> #include <stdio.h> using namespace std; int NEXT[10010]; int s[1000010],p[10010]; int n,m; void GetNEXTval() { int pLen = m; NEXT[0] = -1; int k = -1; int j = 0;原创 2017-12-06 15:18:23 · 181 阅读 · 0 评论 -
数据结构总结之KMP
1.模板:#include <iostream> #include <string.h> #include <stdio.h> using namespace std; int next[1010]; char s[1000],p[1000]; void GetNextval() { int pLen = strlen(p); next[0] = -1; int k = -1原创 2017-12-18 23:02:44 · 337 阅读 · 0 评论