출처 : https://pacific-ocean.tistory.com/147
n = int(input())
p = []
for i in range(n):
p.append(list(map(int, input().split())))
for i in range(1, len(p)):
print(p)
p[i][0] = min(p[i - 1][1], p[i - 1][2]) + p[i][0]
p[i][1] = min(p[i - 1][0], p[i - 1][2]) + p[i][1]
p[i][2] = min(p[i - 1][0], p[i - 1][1]) + p[i][2]
print(p)
print(min(p[n - 1][0], p[n - 1][1], p[n - 1][2]))
출처 : 출처
import sys
n=int(sys.stdin.readline().rstrip())
inp=[list(map(int,sys.stdin.readline().split())) for _ in range(n)]
stk1=[]
stk2=[]
stk3=[]
res1=[]
res2=[]
res3=[]
for i in range(n) :
stk1.append(inp[i][0]) #빨
stk2.append(inp[i][1]) #초
stk3.append(inp[i][2]) #파
print(stk1)
print(stk2)
print(stk3)
res1.append(stk1[0])
res2.append(stk2[0])
res3.append(stk3[0])
for i in range(1,n) :
res1.append(min(stk2[i], stk3[i]))
res2.append(min(stk1[i], stk3[i]))
res3.append(min(stk2[i], stk1[i]))
print(res1)
print(res2)
print(res3)