제출 #1244280

#제출 시각아이디문제언어결과실행 시간메모리
1244280minhpkTelefoni (COCI17_telefoni)C++20
80 / 80
8 ms328 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a,b;
vector <int> z;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> a >> b;
    for (int i=1;i<=a;i++){
         int x;
         cin >> x;
         if (x==1){
             z.push_back(i);
         }
    }
    int res=0;
    for (int i=1;i<z.size();i++){
         int len=z[i]-z[i-1]-1;
         res+=len/b;
    }
    cout << res << "\n";

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...