Python3求助,全WA
查看原帖
Python3求助,全WA
1227790
MC_xjhjdA楼主2024/12/11 18:24
n,m=map(int,input().split())
li={int(x) for x in input().split()}
def ch(g):
    tot=0
    for gx in li:
        tot+=max(gx-g,0)
    return tot>=m
l,r=0,1e6
while l<=r:
    m=int((l+r+1)/2)
    if ch(m):
        l=m+1
    else:
        r=m-1
print(int(l),r)
'''4 7
20 15 10 17'''#15
'''5 20
4 42 40 26 46'''#36
2024/12/11 18:24
加载中...