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 |
球大牛指导,总是WA# 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator