[python]蒟蒻求助,第三个样例RE

P1216 [USACO1.5] [IOI1994]数字三角形 Number Triangles

the_color @ 2022-05-09 12:51:33

n = int(input())
if n == 1:
    print(int(input().strip()))
else:
    tower = []
    for i in range(n):
        tower.append(list(map(int,input().split())))
    for i in range(n-2,-1,-1):
        for j in range(i+1):
            tower[i][j] += max(tower[i+1][j],tower[i+1][j+1])
    print(tower[0][0])

by Terrible @ 2022-05-09 14:10:03

这份代码提交Python3是可以通过的吧。


by the_color @ 2022-05-09 16:08:18

@Terrible 咦,之前还不行的,现在突然就过了(笑哭


by Terrible @ 2022-05-09 16:10:03

鬼知道发生啥事。


|