338. 입국심사

아현·2021년 11월 12일
0

Algorithm

목록 보기
362/400

프로그래머스



1. Python


def solution(n, times):
    answer = 0
    left, right = 1, max(times) * n
    while left <= right:
        mid = (left+ right) // 2
        people = 0
        for time in times:
            people += mid // time
            if people >= n:
                break
                
        if people >= n:
            answer = mid
            right = mid - 1
        else:
            left = mid + 1
            
    return answer



2. C++





3. JavaScript





profile
Studying Computer Science

0개의 댓글