char s[Maxn], t[Maxn];int q[Maxn], head, tail, tot[Maxn];void cal(char c){ memset(f, 0, sizeof(f)); memset(g, 0, sizeof(g)); head=1, tail=0; for(int i=0; i < n; i++){ if(s[i] == c) q[++tail]=i; while(head <= tail && q[head]+k < i) head++; if(head <= tail) f[i].a=1; }head=1, tail=0; for(int i=n-1; i >= 0; i--) { if(s[i] == c) q[++tail]=i; while(head <= tail && q[head] > i+k) head++; if(head <= tail) f[i].a=1; } for(int i=0; i < m; i++) if(t[i] == c) g[m-i-1].a=1; FFT(f, 1); FFT(g, 1); for(int i=0; i < lim; i++) f[i]=f[i]*g[i]; FFT(f, -1); for(int i=0; i < n; i++) tot[i]+=floor(f[i+m-1].a/lim+0.5);}void solve(){ n=read(), m=read(), k=read(); scanf("%s", s); scanf("%s", t); while(lim <= n+m-2) lim<<=1, l++; for(int i=0; i < lim; i++) r[i]=r[i>>1]>>1|((i&1)<= m) ans++; printf("%d", ans);}
(我真是个小天才,用\(char\)来存数组\(orz\))