1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 08:26:20 +00:00
202401-programming-assignments/【实践课外】11.函数2/7-2 N阶楼梯上楼问题.md

42 lines
571 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 7-2 N阶楼梯上楼问题
N阶楼梯上楼问题一次可以走两阶或一阶问有多少种上楼方式。例如当楼梯只有一阶时只有一种方法当楼梯有两阶时可以每次跨一阶跨两次也可以每次跨两阶跨一次因此有两种方法。
### 输入格式:
输入包括一个整数N,(1<=N<46)。
### 输出格式:
输出当楼梯阶数是N时的上楼方式总数
### 输入样例1:
```in
3
```
### 输出样例1:
```out
3
```
### 输入样例2:
```in
4
```
### 输出样例2:
```out
5
```