[BOJ] 1654 랜선 자르기

이강혁·2025년 1월 15일
0

백준

목록 보기
44/60
import sys
input = sys.stdin.readline
k, n = map(int, input().split())
cables = []
for _ in range(k):
  cables.append(int(input()))
max = max(cables)
min = 1
while min <= max:
  mid = (max + min) // 2
  
  total = 0
  for i in cables:
    total += i // mid
    
  if total < n:
    max = mid - 1
  elif total >= n:
    min = mid + 1
print(max)
profile
사용자불량

0개의 댓글

관련 채용 정보