题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to int sum = 1; int a = 0; int b = 0; for(int i = 2;i < n;i++) { sum += a; a = b; b = sum; } printf("%d\n",sum + a + b); } return 0; }