题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
#include <iostream>
using namespace std;
int main() {
int n;
while(cin >> n) {
if(n==1 || n==2) cout << 1;
int prepre= 1;
int pre= 1;
int cur;
for(int i =3; i<=n; i++) {
cur = prepre + pre;
prepre = pre;
pre = cur;
}
cout << cur;
}
}
// 64 位输出请用 printf("%lld")
