코딩
[이진탐색] 떡볶이 떡 만들기.py 본문
start = 0
end = max(array)
result = 0
while(start <= end):
total = 0
mid = (start+end) //2
for x in array:
if x> mid:
tatal += x - mid
if total < m:
end = mid - 1
else:
result = mid
start = mid + 1
print(result)
Comments