Submission #522151

#TimeUsernameProblemLanguageResultExecution timeMemory
522151gghxTelefoni (COCI17_telefoni)C++14
80 / 80
25 ms312 KiB
#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 (stderr)

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;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...