# BOJ - 2512 - 예산

Updated:

```
def solution():
N = int(input())
arr = list(map(int, input().split()))
money = int(input())
left, right = 0, max(arr)
while left <= right:
mid = (left + right) // 2
num = 0
for i in arr:
if i >= mid:
num += mid
else:
num += i
if num <= money: left = mid + 1
else: right = mid - 1
print(right)
solution()
```

https://www.acmicpc.net/problem/2512

## Leave a comment