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 |
牛人帮看一下 就是不过!!!#include <iostream> using namespace std; int main() { char a[150],b[150]; int i; int temp1=0,temp2=0; int RESULT_A[26],RESULT_B[26]; cin.getline(a,150,'\n'); cin.getline(b,150,'\n'); for(i=0;i<26;i++) { RESULT_A[i]=RESULT_B[i]=0; } for(i=0;(a[i]!='\0')&&(b[i]!='\0');i++) { RESULT_B[b[i]-'A']++; RESULT_A[a[i]-'A']++; } for(i=0;i<26;i++) { if(RESULT_A[i]!=RESULT_B[i]&&RESULT_A[i]!=0&&RESULT_B[i]!=0) { cout<<"NO"<<endl; return 0; } if(RESULT_A[i]!=RESULT_B[i]&&RESULT_B[i]==0) temp1+=RESULT_A[i]; if(RESULT_A[i]!=RESULT_B[i]&&RESULT_A[i]==0) temp2+=RESULT_B[i]; } if(temp1!=temp2) { cout<<"NO"<<endl; return 0; } cout<<"YES"<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator