제출 #520848

#제출 시각아이디문제언어결과실행 시간메모리
520848BobbyTelefoni (COCI17_telefoni)C++17
80 / 80
48 ms276 KiB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,d;
    cin>>n>>d;
    int last = -1;
    int ans = 0;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(i>=d+last && x==0){
            ans++;
            last = i;
        }
        else if(x==1){
            last = i;
        }
    }
    cout<<ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...