Skip to content

Commit 6252071

Browse files
committed
[BOJ] #1654.랜선 자르기 / 실버2 / 20(O)
1 parent fa9d759 commit 6252071

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
K, N = map(int, input().split())
5+
lan = [int(input()) for _ in range(K)]
6+
7+
def binary_search(start, end):
8+
while start <= end:
9+
mid = (start + end) // 2
10+
lines = 0
11+
for i in lan:
12+
lines += i // mid
13+
if lines >= N:
14+
start = mid + 1
15+
else:
16+
end = mid - 1
17+
return end
18+
19+
print(binary_search(1, max(lan)))

0 commit comments

Comments
 (0)