Submission #522149

#TimeUsernameProblemLanguageResultExecution timeMemory
522149gghxTelefoni (COCI17_telefoni)C++14
16 / 80
19 ms840 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; } 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...