Advertisement
wrench786

Anik- Of Gears and Boxes

Feb 15th, 2021
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4.  
  5. int main(){
  6.     ll int n,box,capacity,i,prev=0,dum_capa,x;
  7.     cin>>n>>box>>capacity;
  8.     dum_capa = capacity;
  9.     for(i=0;i<n;i++){
  10.         cin>>x;
  11.         if(prev!=x){
  12.             box--;
  13.             prev = x;
  14.             dum_capa= capacity;
  15.         }
  16.         else{
  17.             if(dum_capa==0){
  18.                 box--;
  19.                 dum_capa= capacity;
  20.             }
  21.         }
  22.         dum_capa--;
  23.     }
  24.     cout<<abs(0-box)<<endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement