이분탐색.
import sys
input = sys.stdin.readline
def isPossible(target_time):
balloon=0
for staff in make_balloon:
balloon += target_time//staff
if balloon>=M:
return True
return False
N,M = map(int,input().split())
make_balloon = list(map(int,input().split()))
start = 0
end = 1e12
answer = 0
while start<=end:
mid = (start+end)//2
if isPossible(mid):
end = mid-1
answer=mid
else:
start = mid+1
print(int(answer))
'practivceAlgorithm > 백준' 카테고리의 다른 글
[백준][Python] 19535 ㄷㄷㄷㅈ : 트리 간선에 대한 고찰. (0) | 2021.08.08 |
---|---|
[백준][Python] 11509 풍선맞추기 (0) | 2021.08.08 |
[백준][Python] 1341폴리오미노 (1) | 2021.08.07 |
[백준][Python] 14891 톱니바퀴 (0) | 2021.08.07 |
[백준][Python] 1074 Z (0) | 2021.08.06 |