<代码> # include <比特/stdc + + . h> 使用名称空间性病; const int MaxN=1000000 + 5; 整数N, L; char str MaxN, str2 [MaxN]; struct山姆{ int cntv; int nxt [MaxN]; int [26], ch [26] [MaxN]; 山姆(){nxt [0]=1;} 内联空隙插入(int c) { cntv + +;nxt [cntv]=[c]; for (int i=0;我<26;+ + i) for (int p=[我];p !=1 & & ch [c] [p]==0;p=nxt [p]) ch [c] [p]=cntv; 去年[c]=cntv; } 内联bool检查(int, int x) { 如果(x==L)返回true; int c=str2 [x] - a; 如果(ch [c] [u]==0)返回false; 返回检查(ch [c] (u), x + 1); } }T; 无效的init () { scanf (“% s”, str); scanf (“% d”, n); for (int i=0;str[我];+ + i) T。插入(str[我]- a); } 空白解决(){ for (int i=1;我<=N;+ + i) { scanf (“% s”, str2); L=strlen (str2); 把(T。检查(0,0)?“是”:“不”); } } int main () { init (); 解决(); 返回0; }代码>