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 |
Re:这题太诡异了,我用qsort也过不了,自己排了下过了In Reply To:这题太诡异了,我用qsort也过不了,自己排了下过了 Posted by:19881005 at 2009-07-27 10:39:35 不知qsort能过不,sort可以过,简单的排序都可以的! #include<iostream> #include<cstring> #include<algorithm> using namespace std; int main() { char str[110],str1[110];int length,sign,a[26],b[26]; for(int i=0;i<26;i++) {a[i]=0;b[i]=0;} gets(str); length=strlen(str); for(int j=0;j<length;j++) if(str[j]>='A'&&str[j]<='Z') a[(str[j]-'A')]++; gets(str1); sign=strlen(str1); for(int k=0;k<sign;k++) if(str1[k]>='A'&&str1[k]<='Z') b[(str1[k]-'A')]++; sort(&a[0],&a[26]); sort(&b[0],&b[26]); for(int l=0;l<26;l++) if(a[l]!=b[l]) {cout<<"NO";return 0;} cout<<"YES"; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator