9.21华为笔试
# 第一道题感觉没错,但就过了10%,不知道哪里错了,求大佬帮我看看
def func():
N = int(input())
records = list(map(int, input().split(' ')))
total = int(input())
records.sort()
idx = -1
remainder = total
for i in range(N):
if (N-i)*records[i] <= remainder:
remainder -= records[i]
else:
idx = i
break
if idx==-1:
print(-1)
else:
print(int(remainder/(N-idx)))
if __name__ == "__main__":
func() #华为笔试#
腾讯音乐娱乐集团公司福利 283人发布