"""一个猪圈里有2只刚满2岁的猪,
每只猪只能活4年,每只猪第四年还可以生一次崽
2岁后每2只猪每年可以生4头小猪(假设小猪性别比例总是1:1),
问n年后猪圈里有几只猪?
"""
def func(n):
pig = {1: 0, 2: 2, 3: 0, 4: 0}
for i in range(1, n + 1):
bir = (pig[2] + pig[3] + pig[4]) * 2
pig[4] = pig[3]
pig[3] = pig[2]
pig[2] = pig[1]
pig[1] = bir
return f"--{pig.items()}--{sum(pig.values())}--"
if __name__ == '__main__':
n = int(input('请输入n年后的n:'))
print(func(n))