字符串
South__wind
ACMER
展开
-
poj 2752 Seek the Name, Seek the Fame
http://poj.org/problem?id=2752 #include #include char str[400000]; int next[400000],ans[400000]; void get_next(char *p) { next[0]=-1; int i=-1,j=0; int len=strlen(p); while(j原创 2012-08-29 15:14:33 · 173 阅读 · 0 评论 -
poj 3461 Oulipo
http://poj.org/problem?id=3461(kmp入门) #include #include char p[1000000],s[1000000]; int next[1000000]; int n; void get_next(char *p) { next[0]=-1; int i=-1,j=0; int len=strlen原创 2012-08-29 15:19:46 · 274 阅读 · 0 评论 -
poj 3080 Blue Jeans
求n个字符串的大于三的最长公共子序列。 kmp+暴搜枚举即可。 #include #include char str[10][65]; char ans[65],s[65]; int next[65]; int t,n,max,num; void get_next(char *s,int slen) { int i=-1,j=0; memset(next,0,原创 2012-08-29 15:05:49 · 222 阅读 · 0 评论 -
poj 2406 Power Strings
http://poj.org/problem?id=2406(关于next数组含义的应用,改几行代码就可以A掉1961) #include #include char str[1000000]; int next[1000000]; void get_next(char *p) { next[0]=0; int i=0,j=1; int len=str原创 2012-08-29 15:12:27 · 217 阅读 · 0 评论 -
poj 1961 Period
http://poj.org/problem?id=1961 #include #include char str[1000000]; int next[1000000]; int n; void get_next(char *p) { next[0]=-1; int i=-1,j=0; int len=strlen(p); while(j原创 2012-08-29 15:16:57 · 195 阅读 · 0 评论 -
poj 2541 Binary Witch
#include #include char str[1001000]; int next[1001000]; int n,m; int main() { while(scanf("%d%d%s",&n,&m,str)!=EOF) { int end=n+m; while(n<end) {原创 2012-08-27 20:51:41 · 365 阅读 · 0 评论