兔子爬楼梯
Hopping Rabbit
题目详情
一只兔子在 阶楼梯底部,每次只能向上跳 1 阶或 2 阶。
问:兔子到达楼顶共有多少种不同走法?
A rabbit is at the bottom of an -step staircase. The rabbit can hop up only 1 or 2 steps at a time. In how many distinct ways can the rabbit reach the top?
解析
设 为到达第 阶的走法数。
- ,。
- 对 ,最后一步要么从 跳 1 阶,要么从 跳 2 阶:
因此是斐波那契型递推。
Original Explanation
Let be the number of ways. By induction:
- (just one step).
- (two single steps or one double step).
- For , the rabbit’s last hop is either 1 step or 2 steps: matching the Fibonacci-type recurrence.