Python3代码
import numpy as np
N = int(input())
F = np.zeros((510, 510), dtype=int).tolist()
for i in range(N):
F[i] = list(map(int, input().split()))
for i in range(N, -1, -1):
for j in range(i, -1, -1):
F[i][j] += max(F[i + 1][j], F[i + 1][j + 1])
print(F[i][j])