标签:
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=5
暴力:
#include <stdio.h> #include <string.h> char a[15]; char b[1005]; int len1,len2; int main() { int t; scanf("%d",&t); while(t--) { int i,j; int Count=0; scanf("%s%s",a,b); len1=strlen(a); len2=strlen(b); for(i=0;i<len2-len1+1;i++) { for(j=0;j<len1;j++) { if(a[j]!=b[i+j]) break; } if(j==len1) Count++; } printf("%d\n",Count); } return 0; }
标签:
原文地址:http://www.cnblogs.com/TreeDream/p/5322823.html