跳台阶的算法-python
摘要:
1 def JumpStep(n): 2 if n <= 0: 3 return 0 4 if n == 1 or n == 2: 5 return n 6 7 return (JumpStep(n-1) + JumpStep(n - 2)) 8 while 1: 9 steps = int(raw_input())10 if steps != 0:11 print "%d cases when steps are %d" % (JumpStep(steps), steps)12 else:13... 阅读全文
posted @ 2013-04-17 01:15 applekoz 阅读(298) 评论(0) 推荐(0) 编辑