# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
23097 | 2017-05-03T05:21:30 Z | model_code | Telefoni (COCI17_telefoni) | C++11 | 23 ms | 1116 KB |
#include <cstdio> #include <string> #include <vector> #include <map> #include <cstdlib> #include <algorithm> #include <cstring> using namespace std; typedef long long llint; typedef pair <int, int> pii; int n, d; int main (void){ scanf("%d%d", &n, &d); int last = 0; int ans = 0; for (int i = 0; i < n; ++i) { int x; scanf("%d", &x); if (x == 1) last = i; if (i - last == d) { ++ans; last = i; } } printf("%d\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 0 ms | 1116 KB | Output is correct |
3 | Correct | 0 ms | 1116 KB | Output is correct |
4 | Correct | 0 ms | 1116 KB | Output is correct |
5 | Correct | 0 ms | 1116 KB | Output is correct |
6 | Correct | 0 ms | 1116 KB | Output is correct |
7 | Correct | 0 ms | 1116 KB | Output is correct |
8 | Correct | 23 ms | 1116 KB | Output is correct |
9 | Correct | 23 ms | 1116 KB | Output is correct |
10 | Correct | 23 ms | 1116 KB | Output is correct |