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啊.高手帮忙看看.mail我,THX#include<stdio.h> #include<string.h> #include<stdlib.h> int cmp(const void *a,const void *b){ return(*(int *)a-*(int *)b); } int main(){ //freopen("test.in","r",stdin); char temp[110]; int length,s1[26],s2[26],i,j,change; while(scanf("%s",&temp)!=EOF){ for(i=0;i<26;i++) s1[i]=s2[i]=0; length=strlen(temp); for(i=0;i<strlen(temp);i++) s1[temp[i]-'A']++; scanf("%s",&temp); length=strlen(temp); for(i=0;i<strlen(temp);i++) s2[temp[i]-'A']++; qsort(s1,26,sizeof(s1[0]),cmp); qsort(s2,26,sizeof(s2[0]),cmp); change=1; for(j=0;j<26;j++){ if(s1[j]!=s2[j]){ change=0;break; }} if(change==0) printf("NO\n"); else printf("Yes\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