Submission #471722

# Submission time Handle Problem Language Result Execution time Memory
471722 2021-09-10T14:24:40 Z rainboy Rasvjeta (COCI17_rasvjeta) C
50 / 50
1 ms 280 KB
#include <stdio.h>

int main() {
	int n, m, k, x, x_, ans;

	scanf("%d%d%d", &n, &m, &k);
	x = -k, ans = 0;
	while (m--) {
		scanf("%d", &x_);
		ans += (x_ - x - 1) / (k * 2 + 1), x = x_;
	}
	x_ = n + 1 + k;
	ans += (x_ - x - 1) / (k * 2 + 1), x = x_;
	printf("%d\n", ans);
	return 0;
}

Compilation message

rasjveta.c: In function 'main':
rasjveta.c:6:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d%d%d", &n, &m, &k);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
rasjveta.c:9:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%d", &x_);
      |   ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 276 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 280 KB Output is correct
10 Correct 1 ms 204 KB Output is correct