Submission #463799

# Submission time Handle Problem Language Result Execution time Memory
463799 2021-08-11T19:01:32 Z rainboy Telefoni (COCI17_telefoni) C
80 / 80
32 ms 2008 KB
#include <stdio.h>

#define N	300000

int main() {
	static int aa[N];
	int n, d, i, j, ans;

	scanf("%d%d", &n, &d);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	ans = 0;
	for (i = 0, j = 1; j < n; j++)
		if (aa[j])
			ans += (j - i - 1) / d, i = j;
	printf("%d\n", ans);
	return 0;
}

Compilation message

telefoni.c: In function 'main':
telefoni.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d%d", &n, &d);
      |  ^~~~~~~~~~~~~~~~~~~~~
telefoni.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 32 ms 2008 KB Output is correct
9 Correct 30 ms 1928 KB Output is correct
10 Correct 30 ms 1920 KB Output is correct