这不就是跳石头嘛 (加上sort) 然后就二分答案 搞定~
//By SiriusRen
#include <cstdio>
#include <algorithm>
using namespace std;
int n,k,l=0,r=0x3fffffff,ans,Mid,a[100500];
bool check(){
int temp=1,rec=a[1];
for(int i=2;i<=n;i++)
if(a[i]-rec>=Mid)temp++,rec=a[i];
return temp>=k;
}
int main(){
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
sort(a+1,a+1+n);
while(l<=r){
Mid=(l+r)>>1;
if(check())l=Mid+1,ans=Mid;
else r=Mid-1;
}
printf("%d
",ans);
}