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

球大牛指导,总是WA

Posted by deadstorm at 2011-09-23 10:02:26 on Problem 2159
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <iostream>
using namespace std;
int main()
{char a[105],b[105];
int cc[26];
int flag,i,j;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
memset(cc,0,sizeof(cc));
    while(scanf("%s",a)!=EOF)
    {
    scanf("%s",b);
    flag=0;
   
    for(i=0;i<strlen(b);i++)
    { if((b[i]!='Z')) b[i]=b[i]+1;
      else b[i]=b[i]-25;
          if(b[i]>='A'&&b[i]<='Z') cc[b[i]-'A']++; 
                      }
                         for(j=0;j<strlen(a);j++)
            {if(a[j]>='A'&&a[j]<='Z') {--cc[a[j]-'A'];if(cc[a[j]-'A']<0) {flag=1;break; }}
                             }
                for(i=0;i<26;i++)
                    {if(cc[i]!=0) {flag=1;break;}}
                  if(flag==1) printf("NO\n");
                    else printf("YES\n");
        memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
memset(cc,0,sizeof(cc));
flag=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