随笔分类 -  string

摘要:kmp next数组应用。 1 #include 2 #include 3 const int maxn=1000000+5; 4 char s[maxn]; 5 int next[maxn]; 6 int snext[maxn]; 7 void get_next(char *T,int len,int *next) 8 { 9 next[0]=-1;10 for(int i=1;i=0)14 j=next[j];15 if(T[i]==T[j+1])next[i]=j+1;16 else next[i]=0;17 }1... 阅读全文
posted @ 2013-10-10 21:50 sooflow 阅读(280) 评论(0) 推荐(0)
摘要:数据量较大 卡了好几次超时 看了别人的报告 说是可以把电话号码转成整数,大概就是这么做的。 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn=200000; 6 char s[500]; 7 char key[26]={'2','2','2','3','3','3','4','4','4','5','5','5' 阅读全文
posted @ 2013-08-05 20:52 sooflow 阅读(166) 评论(0) 推荐(0)