题解 | 兔子的数量
def calculate_number(n): number=[2,3] if n<3: return number[n-1] else: for i in range(n-2): number.append(number[i]+number[i+1]) return number[n-1] n=int(input()) print(calculate_number(n))
def calculate_number(n): number=[2,3] if n<3: return number[n-1] else: for i in range(n-2): number.append(number[i]+number[i+1]) return number[n-1] n=int(input()) print(calculate_number(n))
相关推荐