| ||||||||||
| 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:Hash之~~大牛莫见怪~~In Reply To:Hash之~~大牛莫见怪~~ Posted by:200831000423 at 2010-08-09 23:48:46 > #include<cstdio>
> #include<cstdlib>
> const int MAXSIZE=26;
> int anum[MAXSIZE],bnum[MAXSIZE];
>
> int main(){
> char ch;
> while((ch=getchar())!='\n')
> ++anum[ch-'A'];
> while((ch=getchar())!='\n')
> ++bnum[ch-'A'];
> int hash1=0,hash2=0;
> for(int i=0;i!=MAXSIZE;++i){
> hash1+=anum[i]*anum[i];
> hash2+=bnum[i]*bnum[i];
> }
> if(hash1==hash2)
> printf("YES");
> else
> printf("NO");
> return EXIT_SUCCESS;
> }
AB
BD
YES 这样的答案不对吧? 用上面的代码就能run出这样的答案。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator