题解 | #吃糖果#
吃糖果
https://www.nowcoder.com/practice/72015680c32b449899e81f1470836097
#include <iostream>
using namespace std;
int eat(int n)
{
if(n == 1) return 1;
else if(n==2) return 2;
else return eat(n-1)+eat(n-2);
}
int main() {
int n;
while(cin>>n){
cout<<eat(n)<<endl;
}
}
// 64 位输出请用 printf("%lld")
