π λ°±μ€ 10217 KCM Travel
https://www.acmicpc.net/problem/10217
πλ€ μ΅μ€νΈλΌ μκ³ λ¦¬μ¦μΈ μ€ μμμΌλ μλμ¬μ μ μ’ λ¨Ήμλ€...
import sys
import math
def solution():
n, total_cost, tickets = map(int, sys.stdin.readline().split())
path = [[] for _ in range(n + 1)]
for _ in range(tickets):
start, end, cost, time = map(int, sys.stdin.readline().split())
path[start].append((end, cost, time))
MAX = math.inf
temp = [[MAX] * (total_cost + 1) for _ in range(n + 1)]
temp[1][0] = 0
for cost in range(total_cost + 1):
for node in range(n + 1):
if temp[node][cost] != MAX:
for next_node, next_cost, next_time in path[node]:
if next_cost + cost <= total_cost:
temp[next_node][next_cost + cost] = min(temp[next_node][next_cost + cost], temp[node][cost] + next_time)
result = min(temp[n])
if result == MAX:
print('Poor KCM')
else:
print(result)
T = int(input())
for _ in range(T):
solution()
π λμ μ€λͺ velog
π
1. Control + , -> μ€μ μ°½
2. Font κ²μ
μμ κ°μ΄ μ€μ μ νλ€
μ²μ ν°νΈλΆν° μ μ©μ ν ν μμΌλ©΄ λ€μ ν°νΈλ₯Ό μ μ© νλ€.
π μλμ°κ° μ€μΉ λμ΄μλ λλΌμ΄λΈμ λ€μ΄κ°λ³Έ Font νμΌμ΄ μλ€
Fonts νμΌλ‘ λ€μ΄κ° λ€μ΄λ°μ ν°νΈλ₯Ό λ£μ΄μ£Όλ©΄ λλ€.
πJetBrains Font λ€μ΄ 곡μ ννμ΄μ§
https://www.jetbrains.com/ko-kr/lp/mono/
μ λ§ν¬μμ λ°μ ν ttf νμΌμ μλ κΈκΌ΄ νμΌλ€μ Fonts ν΄λμ λ£μ΄μ£Όλ©΄ λλ€.