title: "[프로그래머스] 금과 은 운반하기 Python 파이썬 해설 (Level 3) - 이도훈"
cleanUrl: "programmers/86053"
description: "프로그래머스 Level 3 문제 [금과 은 운반하기]의 풀이를 정리합니다."
def solution(a, b, g, s, w, t):
l, r = 0, int(2 * 1e9 * 2 * 1e5)
while l < r:
mid = (l + r) // 2
tmptotal, tmpg, tmps = 0, 0, 0
for gi, si, wi, ti in zip(g, s, w, t):
n_delivery = (mid + ti) // (2 * ti)
tmptotal += min(wi * n_delivery, gi+si)
tmpg += min(wi * n_delivery, gi)
tmps += min(wi * n_delivery, si)
if tmptotal >= a+b and tmpg >= a and tmps >= b:
r = mid
else:
l = mid+1
return l
프로그래머스 코딩테스트 연습 https://school.programmers.co.kr/learn/challenges