标签:
Time Limit: 14000/7000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 744 Accepted Submission(s): 386
1 #include <bits/stdc++.h> 2 3 char s[100005]; 4 char p[5005]; 5 6 int main() 7 { 8 int T, n, m; 9 scanf("%d", &T); 10 while(T--){ 11 scanf("%d%d", &n, &m); 12 scanf("%s%s", s, p); 13 for(int i = 0; i < n; ++i){ 14 if(i>n-m){ 15 putchar(‘0‘); 16 continue; 17 } 18 bool f = true; 19 for(int j = 0; j < m; ){ 20 if(j<m-1 && p[j] == s[i+j+1] && p[j+1] == s[i+j]){ 21 j += 2; 22 continue; 23 } 24 else if(p[j] != s[i+j]){ 25 f = false; 26 break; 27 } 28 ++j; 29 } 30 putchar(f ? ‘1‘ : ‘0‘); 31 } 32 puts(""); 33 } 34 return 0; 35 }
标签:
原文地址:http://www.cnblogs.com/inmoonlight/p/5695836.html