一对幼兔一个月后长成小兔(每对兔子默认一公一母),再过一个月长成成兔并且生下一对幼兔,以此类推,两年后有多少兔子
int a = 1;
int b = 0;
int c = 0;
for (int i = 1; i <= 24; i++)
{
if (i == 1)
{
a = 1;
b = 0;
c = 0;
}
else
{
c = b + c;
b = a;
a = c;
}
Console.WriteLine("幼兔{0},小兔{1},大兔{2},总数{3}",a,b,c,(a+b+c));