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" #define max 100 int cmp ( const void *a , const void *b ) {return *(int *)a - *(int *)b;} int main() { char a[max],b[max]; int i=0,flag=1,c[26],d[26]; while(1) { gets(a); gets(b); memset(c,0,sizeof(c)); memset(d,0,sizeof(d)); while(a[i]!='\0') { c[a[i]-'A']++; d[b[i]-'A']++; i++; } qsort(c,26,sizeof(c[0]),cmp); qsort(d,26,sizeof(d[0]),cmp); for(i=0;i<26;i++) if(a[i]!=b[i]) { flag=0; break; } if(flag) printf("YES\n"); else printf("NO\n"); } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator