Submission #473628

# Submission time Handle Problem Language Result Execution time Memory
473628 2021-09-15T18:25:56 Z rainboy Kotrljanje (COCI18_kotrljanje) C
140 / 140
905 ms 2828 KB
#include <stdio.h>

#define B	5000
#define L	64

int sum(long long a, int b) {
	return a == 0 ? 0 : sum(a / b, b) + a % b;
}

int main() {
	static int kk[L];
	int c, d, b, m, s;
	long long i;

	scanf("%d%d%d%d", &c, &d, &b, &m);
	for (i = b - 1; ; i += b - 1)
		if (++kk[s = sum(i * c + d, b) / (b - 1)] == m)
			break;
	while (i > 0) {
		if (sum(i * c + d, b) / (b - 1) == s)
			printf("%lld ", i);
		i -= b - 1;
	}
	printf("\n");
	return 0;
}

Compilation message

kotrljanje.c: In function 'main':
kotrljanje.c:15:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf("%d%d%d%d", &c, &d, &b, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 64 ms 2828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 2256 KB Output is correct
2 Correct 48 ms 2324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 2364 KB Output is correct
2 Correct 49 ms 2372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2476 KB Output is correct
2 Correct 53 ms 2568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2540 KB Output is correct
2 Correct 106 ms 2048 KB Output is correct
3 Correct 67 ms 2572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 2756 KB Output is correct
2 Correct 52 ms 2760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 396 KB Output is correct
2 Correct 354 ms 900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 799 ms 1776 KB Output is correct
2 Correct 484 ms 1964 KB Output is correct
3 Correct 905 ms 1912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 2208 KB Output is correct
2 Correct 441 ms 2028 KB Output is correct
3 Correct 71 ms 2624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 2620 KB Output is correct
2 Correct 49 ms 2120 KB Output is correct