nyoj-5 Binary String Matching
有时候总感觉好迷茫,我已经大二了,再有两年就要毕业了,我能在大学里边做些什么,就这么过去了,就像大多数人一样???!!!!!!
#include<stdio.h>
#include<string.h>
int main(){
	int n;
	char str1[20],str2[1020];
	int i,j,k,temp,t,num1,num2;
	scanf("%d",&k);
	while(k--){
		scanf("%s%s",str1,str2);
		num1=strlen(str1);
		num2=strlen(str2);
		int ans=0;
		for(i=0;i<num2;i++){
			temp=0;
			if(str2[i]==str1[0]){
				for(j=1;j<num1;j++){
					if(str1[j]!=str2[j+i])
					  {
					  	temp=1;
					  	break;
					  }
				}
				if(!temp)
			   ans++;		
			}	
		}
		printf("%d\n",ans);
	}
	return 0;
}  
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号