Skip to content

Commit 87180a0

Browse files
committed
[BOJ]#1654. 랜선자르기/실버2/50min
https://www.acmicpc.net/problem/1654
1 parent d8dd9ec commit 87180a0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Hongjoo/백준/랜선자르기.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
K, N = map(int, input().split())
2+
3+
lines = [int(input()) for _ in range(K)]
4+
# 1. 범위 초기화
5+
start = 1
6+
end = max(lines)
7+
#2. 이분 탐색
8+
while start <= end:
9+
mid = (start + end) // 2
10+
cnt = 0
11+
for line in lines:
12+
cnt += line // mid
13+
14+
if cnt < N:
15+
end = mid - 1
16+
else:
17+
start = mid + 1
18+
19+
print(end)

0 commit comments

Comments
 (0)