Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Output Limit Exceeded是怎的...手動測資都對的啊... #include<stdio.h> int main(){ char str1[105],str2[105]; while(gets(str1)!=EOF){ int a[26]={0},b[26]={0},i,j=0,k; gets(str2); for(i=0; str1[i]!='\0'; i++){ int j=(int)str1[i]; a[j-65]++; }; for(i=0; str2[i]!='\0'; i++){ int j=(int)str2[i]; b[j-65]++; }; for(i=0; i<26; i++){ int p=j, q=j+i; for(k=0; k<26; k++){ if(q==26) q=0; if(a[p]!=b[q]) break; p++; q++; }; if(p==26){ printf("YES"); break;}; }; if(i>25) printf("NO"); }; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator