Find the string whichhas this hash: 25267566250558
The string has length8.
Characters can befrom: c,e,i,a,r,w,u,s,p
The hash functionworks like this:
hash(str):
1.LETTERS = c, e, i, a, r, w, u, s, p
2. h =7
3. forc in str:
1.i = index of c in LETTERS
2.h = 37 * h + i
4.return h
Please send us thestring you found, and the code you used to find it.
使用N进制的解法的核心思想是:首先计算出解法的总数(possibilitites),然后从0到possibilitites遍历,将每一个遍历到的结果转换为N进制(这里N是8)。
代码如下:
#coding=utf-8
# for every possiblity , hexadecimal convertion is involved, its complexity is O("pow()*len(需要的字符串的长度)" *每次hash的计算量)
## correct: I found 'surprise' when the index of c in LETTERS begins from 0
# 'uwasaeuc' when 1
#===========&#