#include <bits/stdc++.h>
using namespace std;
int len,n,m;
int s[50010];
bool judge(int a)
{
int tot=0;
for(int i=1;i<n;i++)
{
int t=s[i];
while(s[i+1]-t<a&&i<=n)
{
i++;
tot++;
}
}
if(tot<=m) return true;
else return false;
}
int main()
{
cin >> len >> n >> m;
for(int i=1;i<=n;i++) scanf("%d",&s[i]);
int l=1,r=len+1;
while(l<=r)
{
int mid=(l+r)/2;
if(judge(mid))
{
l=mid+1;
}
else r=mid-1;
}
cout << r;
return 0;
}
答案 输出为238356
我的代码运行结果为236689
请求大佬解答