文件目录

#include <bits/stdc++.h>
using namespace std;
int l, n, m;
int d[50050];
bool pd(int x)
{
    int s = 0; // 当前位置:起点
    int c = 0; // 移走石头
    for (int i = 1; i <= n + 1; i++)
    {
        if (d[i] - s < x)
            c++;
        else
            s = d[i];
    }
    return c <= m;
}
int main()
{
    cin >> l >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> d[i];
    d[n + 1] = l;
    int left = 1, right = l;
    int ans = 0;
    while (left <= right)
    {
        int mid = (left + right) / 2;
        if (pd(mid))
        {
            left = mid + 1;
            ans = mid;
        }
        else
            right = mid - 1;
    }
    cout << ans;
    return 0;
}