답안 #522151

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
522151 2022-02-04T01:11:32 Z gghx Telefoni (COCI17_telefoni) C++14
80 / 80
25 ms 312 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,d;
  cin>>n>>d;
  ll cur=0,count=0,ans=0;
  for(int i=0;i<n;i++){
    bool x;
    cin>>x;
    if(x==1){
      cur=i;
      count=0;
    }
    else{
      count++;
      if(count==d){
        count=0;
        cur=i;
        ans++;
      }
    }
  }
  cout<<ans;

}

Compilation message

telefoni.cpp: In function 'int main()':
telefoni.cpp:10:6: warning: variable 'cur' set but not used [-Wunused-but-set-variable]
   10 |   ll cur=0,count=0,ans=0;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 21 ms 204 KB Output is correct
9 Correct 25 ms 304 KB Output is correct
10 Correct 18 ms 312 KB Output is correct