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:您有空的话帮忙看一下。。。。In Reply To:您有空的话帮忙看一下。。。。 Posted by:fujieyun at 2005-08-23 18:51:19 function hash( st : string ): longint; var i, h, g : longint; begin h := 0; for i := 1 to length(st) do // 这个是不是可以用 len = length(s);代替呢 begin h := h shl 4 + ord( st[i] ); g := h and ($f0000000); if g>0 then h := h xor( g shr 24 ); h := h and (not g); end; h := h mod m; hash := h; {h := 0; for i := 1 to length(st) do h := (h*256 + ord( st[i] )) mod m;} end; Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator