摘要:
阅读全文
posted @ 2020-03-29 13:13
木子欢儿
阅读(183)
评论(0)
推荐(0)
摘要:
count=0 def hanoi(n,src,dst,mid): #n为圆盘数量,src表示源柱子,dst表示目标柱子,mid表示中间过渡柱子 global count #定义全局变量 if n==1: print("{}:{}->{}".format(1,src,dst)) count+=1 e 阅读全文
posted @ 2020-03-29 12:56
木子欢儿
阅读(238)
评论(0)
推荐(0)
摘要:
代码 def f(n): if n==1 or n==2: return 1 else: return f(n-1)+f(n-2) print(f(1)) print(f(2)) print(f(3)) 阅读全文
posted @ 2020-03-29 12:23
木子欢儿
阅读(495)
评论(0)
推荐(0)
摘要:
代码: def rvs(s): if s=="": return s else: return rvs(s[1:])+s[0] print(rvs("123")) 阅读全文
posted @ 2020-03-29 09:55
木子欢儿
阅读(198)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2020-03-29 09:48
木子欢儿
阅读(150)
评论(0)
推荐(0)

浙公网安备 33010602011771号