코딩 테스트/문제 풀기
[프로그래머스] 입국심사
hazel_
2021. 5. 2. 19:10
programmers.co.kr/learn/courses/30/lessons/43238
이진트리 사용
def solution(n, times):
answer=0
left=1
right=max(times)*n
while left <= right:
mid=(left + right) // 2
count=0
for time in times:
count += mid//time
if count >= n:
break
if count >= n:
answer = mid
right = mid-1
else:
left = mid+1
return answer