hdu--2203--亲和数(循环a串使包含b串)

    技术2022-06-11  55

    #include "stdio.h" #include "string.h" int main() { int k, len1,len2, i, j, km1,km2; char str1[100002], str2[100002]; while(scanf("%s %s",str1,str2)!=EOF) { k=0; len1=strlen(str1); len2=strlen(str2); if(len1<len2) printf("no/n"); else { while(k<=len1-1) { km1=k; km2=0; while(str1[km1]==str2[km2]&&str2[km2]) { km1++;km2++; if(km1>len1-1) km1=0; } if(!str2[km2]) {printf("yes/n");break; } else k++; } if(k>len1-1) printf("no/n"); } } return 0; }


    最新回复(0)