Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!

2012年3月14日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3374最小表示+KMPView Code 1 #include <stdio.h> 2 #include <string.h> 3 #define max(a,b) ((a)>(b)?(a):(b)) 4 #define min(a,b) ((a)<(b)?(a):(b)) 5 6 const int N=1000100; 7 char str[N],dstr[N*2],t[N*2]; 8 int fail[N]; 9 int minmaxs(const char *str 阅读全文
posted @ 2012-03-14 16:56 Qiuqiqiu 阅读(192) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1711KMPView Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int M=10010,N=1000010; 6 int a[N],b[M]; 7 int fail[M]; 8 void kmp(const int *s,int l) 9 {10 fail[0]=-1;11 int i,j=-1;12 for (i=1;i<l;i++)13 {14 ... 阅读全文
posted @ 2012-03-14 08:36 Qiuqiqiu 阅读(136) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2896AC自动机View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 const int N=60010,B=128; 7 int trie[N][B]; 8 int fail[N]; 9 int key[N];10 int size,id;11 int que[N];12 char w[10010];13 int web[5] 阅读全文
posted @ 2012-03-14 07:54 Qiuqiqiu 阅读(222) 评论(0) 推荐(0) 编辑