题解 | #吃糖果#
吃糖果
https://www.nowcoder.com/practice/72015680c32b449899e81f1470836097
#include <iostream> using namespace std; int dp(int n){ if(n == 1) return 1; else if(n == 2) return 2; else return dp(n - 1) + dp(n - 2); } int main() { int n; cin >> n; cout << dp( n ); return 0; }