Skip to content

Commit

Permalink
Create 실전문제3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaehyeonee authored Nov 9, 2021
1 parent 6debd1b commit 3ef3179
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Binary_search_Algorithm/실전문제3
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#이코테 스터디 이진탐색 3번
n, m = list(map(int, input().split(' ')))

array = list(map(int, input().split()))

start = 0
end = max(array)

result = 0
while(start<=end):
total = 0
mid=(start+end)//2
for x in array:
if x>mid:
total +=x-mid

if total < m:
end = mid -1
else:
result = mid
start = mid+1


print(result)

0 comments on commit 3ef3179

Please sign in to comment.