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 |
CE了四次,题意很重要啊,还有就是不能按照举例来,注意清0#include<stdio.h> #include<string.h> int main() { char a[110]={'0'},b[110]={'0'}; int i,j; char t,ch; while(scanf("%s %s",a,b)!=EOF) { int k=0; int x[26]={0},y[26]={0}; int t1=strlen(a); int t2=strlen(b); if(t1==t2) { for(i=0;i<t1;i++) { x[a[i]-'A']++; y[b[i]-'A']++; } for(j=0;j<25;j++) for(i=0;i<25-j;i++) { if(x[i]>x[i+1]) { t=x[i]; x[i]=x[i+1]; x[i+1]=t; } if(y[i]>y[i+1]) { ch=y[i]; y[i]=y[i+1]; y[i+1]=ch; } } for(i=0;i<26;i++) { if(x[i]==y[i]) k++; } if(k==26)printf("YES\n"); else printf("NO\n"); } else printf("NO\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator