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 popzkk at 2010-05-18 14:40:15 on Problem 3274
In Reply To:对数组hash,这个果然很好很强大 Posted by:happynp at 2008-07-06 21:15:10
> 从网上搞来的,好像是折叠法
> inline int hashcode(const int *v)
> {
> 	int s = 0;
> 	for(int i=0; i<k; i++)
> 		s=((s<<2)+(v[i]>>4))^(v[i]<<10);
> 	s = s % M;
> 	s = s < 0 ? s + M : s;
> 	return s;
> }
太NB了!!!膜拜!
我的乱七八糟HASH,...要700+ms. 就是把它当做一个N进制数处理, 还用了long long...

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