Python求助,只 AC on #1
查看原帖
Python求助,只 AC on #1
1227790
MC_xjhjdA楼主2025/1/22 15:35
L,n,m=map(int,input().split())
li=[int(input())for _ in range(n)]+[L]
def ch(g):
    gx=st=0
    for x in range(n+1):
        if li[x]-st<g:
            gx+=1
        else:st=li[x]
    return gx<=m
l,r=1,L
while l<=r:
    m=(l+r)//2
    if ch(m):l=m+1
    else:r=m-1
print(l-1)
2025/1/22 15:35
加载中...