欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

python如何計(jì)算斐波那契函數(shù)的運(yùn)算時(shí)間以及計(jì)算結(jié)果

python如何計(jì)算斐波那契函數(shù)的運(yùn)算時(shí)間以及計(jì)算結(jié)果?

def Fibonacci(n):

if n == 1:

return 1

dic = [-1 for i in xrange(n)]

dic[0], dic[1] = 1, 1

helper(n-1, dic)

linesize = 5

file=open('Fibonacci.txt', 'w')

for loop in range(len(dic)/linesize):

line = []

for i in range(linesize):

line.append(dic[i + linesize * loop])

file.write("\t".join([str(x) for x in line]) + "\n")

file.close()

def helper(n, dic):

if dic[n] < 0:

dic[n] = helper(n-1, dic)+helper(n-2, dic)

return dic[n]