1 #include <stdio.h> 2 3 int main(void) 4 { 5 int a, b; 6 int t; 7 int month; 8 int amount; 9 10 scanf("%d", &amount); 11 12 a = 0; 13 b = 1; //初始化,第一个月有一对兔子 14 month = 1; 15 while (b < amount) 16 { 17 month++; 18 t = a + b; 19 a = b; 20 b = t; 21 } 22 23 printf("%d ", month); 24 25 return 0; 26 }