Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(){
- freopen("input.txt","r",stdin);
- freopen("output.txt","w",stdout);
- scanf("%d %d %d",&N,&M,&K);
- for(int i=0;i<N;i++){
- int t;
- scanf("%d",&t);
- d.push_back(t);
- }
- d.push_back(K);
- int curr = 0;
- vi::iterator it = d.begin();
- while(1){
- it = upper_bound(d.begin(),d.end(),curr+M);
- if(it == d.end())
- break;
- it--;
- curr = *it;
- c++;
- }
- cout<<c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement