KMP的模版题。#include<iostream>#include<stdio.h>#include<string.h>#define MAXD 10001using namespace std;int N,q[MAXD],RES;char T[MAXD*100],P[MAXD];void PREFIX(){ int m=strlen(P); q[0]=-1; int k=-1; int i; for(i=1;i<m;i++) { while(k>=0&&P[k+1]!=P[i]) k=q[k]; if(P[k+1... Read More