답안 #1024031

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1024031 2024-07-15T10:42:14 Z kustizus Telefoni (COCI17_telefoni) C++17
80 / 80
10 ms 860 KB
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

ll n,k,x,d,ans=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>k;
    for (ll i=1;i<=n;i++){
        cin>>x;
        if (x==1) d=0;
        else if (x==0) d++;
        if (d==k){
            d=0;
            ans++;
        }
    }
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 10 ms 860 KB Output is correct
9 Correct 10 ms 860 KB Output is correct
10 Correct 9 ms 860 KB Output is correct