竞赛
考级
def count_ways(n): # 初始化 dp 数组 dp = [0] * (n + 1) # 填充初始值 dp[0], dp[1], dp[2] = 1, 1, 2 # 计算 dp[n] for i in range(3, n + 1): dp[i] = dp[i-1] + dp[i-2] + dp[i-3] return dp[n] 测试 n=int(input()) print(count_ways(n))
坤坤之神