#include <iostream>
using namespace std;
int n, dist, i, x, NrZeroConsecutive, sol;
int main(){
cin>>n>>dist;
for(i=1; i<=n; i++){
cin>>x;
if(x==0){
NrZeroConsecutive++;
}else{
sol+=NrZeroConsecutive/dist;
NrZeroConsecutive=0;
}
}
cout<<sol;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
75 ms |
980 KB |
Output is correct |
9 |
Correct |
75 ms |
888 KB |
Output is correct |
10 |
Correct |
77 ms |
944 KB |
Output is correct |