Commit 3a7e1217 by BellCodeEditor

auto save

parent 06e2df96
Showing with 27 additions and 15 deletions
# 尝试编写func()函数输出斐波那契数列的第十五个数是什么? # def myfun(x,y)
# 斐波那契数列:1,1,2,3,5,8,13,21,34,55…… # if y==1 or y==x:
def func(n): # return 1
# else:
# z = myfunc(x-1,y-1)+myfunc(x-1,y)
# return z
# n = int(input("行数:"))
# for i in range(1,n+1):
# for j in range(1,i+1):
# print(myfunc(i,j),end=" ")
# print()
def fish(n,z):
print(func(15)) #调用函数并打印结果 if (z-1)%5==0:
if n==1:
return 1
else:
return fish(n-1,(z-1)/5*4)
return 0
i = 0
while True:
i+=1
x=i*5+1
if (fish(5,x)):
print(x)
break
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment