Skip to content

Commit 1b41801

Browse files
authored
Update 2.py
1 parent 7b7f877 commit 1b41801

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

16/2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
n = int(input())
2-
data = []
2+
dp = []
33

44
for _ in range(n):
5-
data.append(list(map(int, input().split())))
5+
dp.append(list(map(int, input().split())))
66

77
# 다이나믹 프로그래밍으로 2번째 줄부터 내려가면서 확인
88
for i in range(1, n):
@@ -11,13 +11,13 @@
1111
if j == 0:
1212
up_left = 0
1313
else:
14-
up_left = data[i - 1][j - 1]
14+
up_left = dp[i - 1][j - 1]
1515
# 바로 위에서 내려오는 경우
1616
if j == i:
1717
up = 0
1818
else:
1919
up = data[i - 1][j]
2020
# 최대 합을 저장
21-
data[i][j] = data[i][j] + max(up_left, up)
21+
dp[i][j] = dp[i][j] + max(up_left, up)
2222

2323
print(max(data[n - 1]))

0 commit comments

Comments
 (0)