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

Hash之~~大牛莫见怪~~

Posted by 200831000423 at 2010-08-09 23:48:46 on Problem 2159 and last updated at 2010-08-09 23:52:00
#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;
}

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