赞
踩
- #include <iostream>
- #include <cstdio>
- #include <vector>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cmath>
- #include <map>
- #include <set>
- #include <queue>
- #define sf(a) scanf("%d\n",&a)
- #define E 1e-8
- #define pi acos(-1.0)
- #define ms(a) memset(a,0,sizeof a)
- #define rep(a,b,c) for(int a=b;a<=c;a++)
- #define pf(a) printf("%.3lf\n",a)
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- const int inf=0x3f3f3f3f;
- const int idata=1e6+5;
-
- int i,j,k;
- //int judge,flag;
- ll step[idata];
- //ll dp[idata][10];
- ll temp;
- ll n,m,t;
- ll maxx=0,minn=inf;
- ll cnt,len,sum,ans;
- ll high,wigh;
- //map<ll,int>pre[2];
- set<ll>s;
- //priority_queue<ll, vector<ll>,less<ll> >q;
- queue<ll>q;
-
- bool check(int aim)
- {
- int temp=0;//目前位置
- int ans=0;
- rep(i,1,n)
- {
- if(step[i]-temp<aim)//将石头删掉
- ans++;
- else
- temp=step[i];
- }
- if(m-temp<aim) ans++;
- return ans<=k;
- }
- int main()
- {
- while(cin>>m>>n>>k)
- {
- rep(i,1,n)
- {
- cin>>step[i];
- }
- int l=0,r=m;
- while(r-l>1)
- {
- int mid=(l+r)/2;
- if(check(mid))
- l=mid;
- else
- r=mid;
- }
- cout<<l<<endl;
- }
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。