Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:Hash之~~大牛莫见怪~~

Posted by mci2004 at 2016-03-21 18:22:54 on Problem 2159
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator