08 2017 档案
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1e5+7; 7 8 int siz[maxn],dep[maxn],top[maxn],tid[maxn],ran[maxn],fa[maxn],son[maxn]; 9 int tot ,kkk ,head[ma...
阅读全文
摘要:拓展kmp是对KMP算法的扩展,它解决如下问题: 定义母串S,和字串T,设S的长度为n,T的长度为m,求T与S的每一个后缀的最长公共前缀 其中next数组表示T[i,m-1]和T的最长公共前缀
阅读全文
摘要:1 const int maxn = 1e5 + 7; 2 const int SIZE = 10;// 字符数量,如小写字母改为26,记得修改getid 3 4 struct Dictionary_tree{ 5 int cnt; 6 int next[maxn][SIZE]; 7 int val[maxn]; 8 9 void init(...
阅读全文
摘要:1 int c[MAXN]; 2 int n; 3 4 int lowbit(int x){ 5 return (x&(-x)); 6 } 7 8 void updata(int x,int v){ 9 while(x 0){//从大到小求和 18 sum += c[x]; 19 x -= lowbit(x); 20 ...
阅读全文
摘要:1 void Out(int a) //输出一个整型 2 { 3 if(a9) 9 Out(a/10); 10 putchar(a%10+'0'); 11 }
阅读全文
摘要:void nextInt(int &x) {//读取一个整型 char c; do c=getchar(); while (c'9'); x=c-'0'; while ('0'<=(c=getchar())&&c<='9') x=x*10+c-'0'; }
阅读全文

浙公网安备 33010602011771号