BOJ - 1654 - 랜선 자르기
Updated:
import sys
def solution():
line = []
K, N = map(int, sys.stdin.readline().split())
for _ in range(K):
line.append(int(input()))
low = 1
plus = 0
ret = 0
high = max(line)
while low <= high:
mid = (low + high) // 2
for i in line:
plus += i // mid
if plus >= N:
low = mid + 1
ret = mid
plus = 0
else:
high = mid - 1
plus = 0
print(ret)
solution()
https://www.acmicpc.net/problem/1654
Leave a comment