Devvy-Is-Free
[Python] softeer.ai 조립라인 본문

import sys
input = sys.stdin.readline
N = int(input())
assembly_line = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
dp = [[0 , 0]] * N
dp[0] = [assembly_line[0][0], assembly_line[0][1]]
for i in range(1, N):
dp[i] = [min(dp[i-1][0], dp[i-1][1] + assembly_line[i-1][3]) + assembly_line[i][0], # A 조립라인
min(dp[i-1][1], dp[i-1][0] + assembly_line[i-1][2]) + assembly_line[i][1]] # B 조립라인
print(min(dp[N - 1]))
'Programming > Algorithm' 카테고리의 다른 글
| [Python] 프로그래머스 푸드 파이트 대회, 파이썬 문자열 문법 (1) | 2024.03.19 |
|---|---|
| [Python] 프로그래머스 K번째수, 파이썬 배열 리스트 문법 (1) | 2023.11.04 |
| [Python] softeer.ai 슈퍼컴퓨터 클러스터 (0) | 2022.10.04 |
| [Python] softeer.ai 금고털이 (0) | 2022.10.03 |
| [Python] softeer.ai 우물 안 개구리 (0) | 2022.10.03 |