#include <iostream>
#include <algorithm>
using namespace std;
int n,v[500100],l=0,nr=0,k;
int main(){
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>v[i];
}
for(int i=1;i<=n;i++){
if(v[i]==0){
l++;
}
else{
if(l>=k){
nr+=l/k;
}
l=0;
}
}
cout<<nr;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
78 ms |
2084 KB |
Output is correct |
9 |
Correct |
78 ms |
2012 KB |
Output is correct |
10 |
Correct |
77 ms |
2040 KB |
Output is correct |