Submission #463799

#TimeUsernameProblemLanguageResultExecution timeMemory
463799rainboyTelefoni (COCI17_telefoni)C11
80 / 80
32 ms2008 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...