
acm字符串匹配
JustSteps
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu2594
#include #include #include using namespace std; char t[50005]; char p[50005]; int next[50005]; void get_next(int m) { int i=0; int j=-1; next[0]=-1; while(i<m) { if(j==-原创 2013-01-31 20:33:35 · 776 阅读 · 0 评论 -
hdu3374 最小表示法+kmp
最小循环节见这里:点击打开链接 最小表示法见这里:点击打开链接 #include #include #include using namespace std; char s[2000005]; char t[2000005]; char s1[2000005]; int next[1000005]; void get_next(char *s,int *next) { int l原创 2013-03-27 10:19:27 · 940 阅读 · 0 评论 -
hdu2896 AC自动机
#include #include #include #include #include using namespace std; struct node { int flag; node *next[100]; node *fail; node():flag(0) { memset(next,0,sizeof(next));原创 2013-03-27 14:14:56 · 664 阅读 · 0 评论 -
hdu2222 AC自动机
貌似理解还不是很深。 #include #include #include #include using namespace std; struct node { int cnt; node *next[27],*fail; node():cnt(0) { memset(next,0,sizeof(next)); fail=原创 2013-03-27 13:24:41 · 707 阅读 · 0 评论 -
hdu1867
http://acm.hdu.edu.cn/showproblem.php?pid=1867 代码写复杂了~ #include #include #include using namespace std; char s[100005]; char t[100005]; int nextt[100005]; int nexts[100005]; char res1[200005]; cha原创 2013-03-26 22:06:56 · 1054 阅读 · 0 评论 -
hdu1686
http://acm.hdu.edu.cn/showproblem.php?pid=1686 #include #include #include using namespace std; char w[15000]; char t[1000005]; int next[15000]; void get_next() { int l=strlen(w); int i,j;原创 2013-03-26 14:07:46 · 1385 阅读 · 0 评论 -
hdu3336
http://acm.hdu.edu.cn/showproblem.php?pid=3336 #include #include #include using namespace std; int next[200005]; char str[200005]; void get_next(char *str,int n) { int i,j; next[0]=-1;原创 2013-03-04 21:56:54 · 1923 阅读 · 4 评论 -
hdu2087
http://acm.hdu.edu.cn/showproblem.php?pid=2087 #include #include #include using namespace std; char a[1005],b[1005]; int next[1005]; void getnext(char *b) { int l=strlen(b); int i=0,j=-1;原创 2013-03-04 21:52:10 · 1691 阅读 · 0 评论 -
hdu3746
#include #include #include using namespace std; char t[1000005]; int next[1000005]; void get_next(int n) { int i=0; int k=-1; next[0]=-1; while(i<=n) //多算了一个next[n] n-next[原创 2013-02-02 20:10:27 · 638 阅读 · 0 评论 -
hdu1358
#include #include #include using namespace std; char t[1000005]; int next[1000005]; void get_next(int n) { int i=0; int k=-1; next[0]=-1; while(i<=n) { if(k==-1||t[i]==t原创 2013-02-02 19:13:24 · 559 阅读 · 0 评论 -
hdu1711
#include #include #include using namespace std; int t[1000005]; int p[10005]; int next[10005]; void get_next(int m) { int i=0; next[0]=-1; int j=-1; while(i<m) { if(j==-原创 2013-01-31 20:34:28 · 544 阅读 · 0 评论 -
hdu3065 AC自动机
#include #include #include #include using namespace std; struct node { int flag; node *next[100],*fail; node():flag(0) { memset(next,0,sizeof(next)); fail=0; }原创 2013-03-27 15:23:44 · 556 阅读 · 0 评论