题解 | #跳台阶#
跳台阶
https://www.nowcoder.com/practice/bfb2a2b3cdbd4bd6bba0d4dca69aa3f0
#include <iostream> using namespace std; int func(int n) { if(n == 0) return 0; else if(n == 1) return 1; else if(n == 2) return 2; else return func(n-1) + func(n-2); } int main() { int n; cin >> n; cout << func(n) << endl; return 0; }