嵇爾的吐槽

#没事画轮子的嵇尔不定期的(W)碎(E)碎(B)念(B)和(L)吐(O)槽(G)

Problem 62 Cubic permutations 2019-07-12 08:30:00

The cube, 41063625 ( ), can be permuted to produce two other cubes: 56623104 ( ) and 66430125 ( ). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube.

Find the smallest cube for which exactly five permutations of its digits are cube.

这个感觉很简单啊

LIST = {}
for i in range(1, 10000):
    result = i*i*i
    LIST[i] = result


LL = {}

for key in LIST:
    n = list(str(LIST[key]))
    n.sort()
    nnn = ''.join(n)
    if LL.has_key(nnn):
        LL[nnn].append(LIST[key])
    else:
        LL[nnn] = [LIST[key]]

print len(LL)
for key in LL:
    if len(LL[key]) == 5:
        print LL[key]
评论共