[๋ฐฑ์ค-1149] RGB๊ฑฐ๋ฆฌ / Python
๐ Problem Solving/Baekjoon
https://www.acmicpc.net/problem/1149
n = int(input())
data = []
for _ in range(n):
data.append(list(map(int, input().split())))
for i in range(1, n):
for j in range(3):
if j == 0:
data[i][j] = min(data[i - 1][1], data[i - 1][2]) + data[i][j]
elif j == 1:
data[i][j] = min(data[i - 1][0], data[i - 1][2]) + data[i][j]
elif j == 2:
data[i][j] = min(data[i - 1][0], data[i - 1][1]) + data[i][j]
print(min(data[-1]))
ํด์ค
๊ฐ๋จํ ๋ฌธ์ ์๋ค. ์ด์ ์ง์ ์๊ธฐ์ ๋ค๋ฅธ ์ธ๋ฑ์ค๋ฅผ ๊ฐ์ง ๊ฐ์ ์ต์๋ฅผ ๋ํด์ฃผ๋ฉด ๋๋ค.
'๐ Problem Solving > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค-1912] ์ฐ์ํฉ / Python (0) | 2021.05.19 |
---|---|
[๋ฐฑ์ค-11053] ๊ฐ์ฅ ๊ธด ์ฆ๊ฐํ๋ ๋ถ๋ถ ์์ด / Python (0) | 2021.05.19 |
[๋ฐฑ์ค-1932] ์ ์ ์ผ๊ฐํ / Python (0) | 2021.05.19 |
[๋ฐฑ์ค-17626] Four Squares / Python (1) | 2021.05.18 |
[๋ฐฑ์ค-2776] ์๊ธฐ์ / Python (0) | 2021.05.18 |