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<stdio.h> #include<stdlib.h> #include<string.h> int cmp(const void * arg1,const void * arg2) { int * a,* b; a=(int *)arg1; b=(int *)arg2; return (*b)-(*a); } int main() { char a[100],b[100]; int lena,i,anum[27],bnum[27],flag; memset(anum,0,sizeof(anum)); memset(bnum,0,sizeof(bnum)); gets(a); gets(b); lena=strlen(a); for(i=0;i<lena;i++) { anum[a[i]-'A'+1]++; bnum[b[i]-'A'+1]++; } qsort((void *)(&anum[1]),26,sizeof(anum[0]),cmp); qsort((void *)(&bnum[1]),26,sizeof(bnum[0]),cmp); flag=1; for(i=1;i<=26 && flag;i++) { if(anum[i]!=bnum[i]) flag=0; } if(flag==1) printf("YES\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