• 2022-05-30
    有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,用户输入一个大于2的月份数,计算输出该月的兔子总对数。
    A: month = int(input())a, b = 1, 1for i in range(3, month + 1):a = bb = a + bprint(b)
    B: month = int(input())a, b = 1, 1for i in range(3, month + 1):b = a + ba = b - aprint(b)
    C: month = int(input())a, b = 1, 1for i in range(3, month + 1):b = a + ba = a - bprint(b)
    D: month = int(input())a, b = 1, 1for i in range(3, month + 1):a, b = b, a + bprint(b)