通过代码:
#include <bits/stdc++.h> #define LL long long using namespace std; LL n, Step[101] = { 0, 1, 2 }; LL step(LL _n) { if(Step[_n] != 0) return Step[_n]; else return Step[_n] = step(_n - 2) + step(_n - 1); } int main() { while(scanf("%lld", &n) != EOF) printf("%lld\n", step(n)); return 0; }
1204:爬楼梯
最新推荐文章于 2024-04-04 17:16:28 发布