40 lines
595 B
Python
40 lines
595 B
Python
# coding=utf-8
|
|
def divnum(a):
|
|
mod = []
|
|
div = 1
|
|
while 1:
|
|
tmp = div % a
|
|
if tmp == 0:
|
|
return len(mod)
|
|
elif mod.count(tmp): break
|
|
else:
|
|
mod.append(tmp)
|
|
div *= 10
|
|
return len(mod) - mod.index(tmp)
|
|
|
|
|
|
def divnum1(a):
|
|
while a % 2 == 0:
|
|
a /= 2
|
|
while a % 5 == 0:
|
|
a /= 5
|
|
j = 1
|
|
while 1:
|
|
tmp = int('9' * j)
|
|
if tmp % a == 0:
|
|
return str(tmp / a)
|
|
j += 1
|
|
|
|
|
|
|
|
maxnum = [0, 0]
|
|
maxx = 1000
|
|
for i in xrange(1, maxx + 1):
|
|
temp = divnum(i)
|
|
#temp = len(divnum1(i))
|
|
if temp > maxnum[1]:
|
|
maxnum[0] = i
|
|
maxnum[1] = temp
|
|
|
|
print maxnum
|