10分
查看原帖
10分
1044040
jyc114514楼主2024/6/27 22:02
a, b, m, x = int(input()), int(input()), int(input()), int(input())
c = 0
s = []
for i in range(x):
    if i == 0:
        s.append(a)
    elif i == 1:
        s.append(b)
    else:
        s.append(s[-1] + s[-2])
        c += s[-1]
    if s[-1] >= m:
        break
print(c)
2024/6/27 22:02
加载中...