题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
#include <iostream>
using namespace std;
int rabbit(int one,int two,int three,int n){
int tem;
while(n--){
three = three + two;
two = one;
one = three;
}
return one+two+three;
}
int main() {
int n;
while (cin >> n) {
cout<<rabbit(1, 0, 0, n-1)<<endl;
}
}