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