#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n, d, x, cur = 0, ans = 0;
cin >> n >> d;
for(int i = 1; i <= n; i++){
cin >> x;
if(x == 0){
cur += 1;
}
else{
ans += cur / d;
cur = 0;
}
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
19 ms |
896 KB |
Output is correct |
9 |
Correct |
19 ms |
1152 KB |
Output is correct |
10 |
Correct |
18 ms |
948 KB |
Output is correct |