题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
#include <iostream>
using namespace std;
int total(int n) {
if (n == 1 || n == 2)
return 1;
else
return total(n - 1) + total(n - 2);
}
int main() {
int n;
cin >> n;
cout << total(n) << endl;
return 0;
}
#斐波那契数列##兔子#