====== 입국심사 ====== ===== 풀이 ===== * 원본은 COCI에 출제되었던 문제로, BOJ에도 동일한 문제를 번역한 것이 [[ps:problems:boj:3079]]에 있다. 풀이는 그쪽을 참고. ===== 코드 ===== """Solution code for "Programmers 43238. 입국심사". - Problem link: https://programmers.co.kr/learn/courses/30/lessons/43238 - Solution link: http://www.teferi.net/ps/problems/programmers/43238 """ from teflib import algorithm def solution(n, times): def is_possible(total_time): checkable_passenger_count = sum(total_time // time for time in times) return checkable_passenger_count >= n upper_bound = max(times) * (len(times) // n + 1) return algorithm.binary_search(0, upper_bound + 1, is_possible) * Dependency: [[:ps:teflib:algorithm#binary_search|teflib.algorithm.binary_search]] {{tag>프로그래머스 ps:problems:programmers:Level_3}}