Commit 6497e469 by BellCodeEditor

save project

parent 92449b0c
Showing with 32 additions and 5 deletions
def func(n):
if n<=2:
return 1
elif n>2:
value = func(n-1)+func(n-2)
return value
result = func(10)
print(result)
\ No newline at end of file
def peach(n):
if n == 10:
return 1
num = (peach(n+1)+1)*2
return num
peach_num = peach(5)
print(peach_num)
\ No newline at end of file
list1 = [] import time
for a in range(0, 1000):
for b in range(0, 1000): start_time = time.time()
list1.insert(0, 0) for a in range(0,1001):
\ No newline at end of file for b in range(0,1001):
c = 1000-a-b
if a**2 + b**2 == c**2:
print("a,b,c的值分别为:",a,b,c)
end_time = time()
print("结束时间为:",end_time)
result = end_time - start_time
print("总共耗时",result)
\ 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