Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Output Limit Exceeded是怎的...

Posted by kaeteyaruyo at 2017-02-23 22:01:56 on Problem 2159
手動測資都對的啊...
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator