Submission #463805

# Submission time Handle Problem Language Result Execution time Memory
463805 2021-08-11T19:12:18 Z rainboy Savrsen (COCI17_savrsen) C
60 / 120
1488 ms 78608 KB
#include <stdio.h>

#define A	10000000

int abs_(int a) { return a > 0 ? a : -a; }

long long dp[A + 1];

void init() {
	int a, b;

	for (a = 1; a + a <= A; a++) {
		for (b = a + a; b <= A; b += a)
			dp[b] += a;
		dp[a] = dp[a - 1] + abs_(a - dp[a]);
	}
}

int main() {
	int a, b;

	init();
	scanf("%d%d", &a, &b);
	printf("%lld\n", dp[b] - dp[a - 1]);
	return 0;
}

Compilation message

savrsen.c: In function 'main':
savrsen.c:23:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  scanf("%d%d", &a, &b);
      |  ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1488 ms 78520 KB Output is correct
2 Correct 1427 ms 78524 KB Output is correct
3 Correct 1453 ms 78524 KB Output is correct
4 Incorrect 1398 ms 78540 KB Output isn't correct
5 Incorrect 1398 ms 78608 KB Output isn't correct
6 Incorrect 1420 ms 78524 KB Output isn't correct
7 Incorrect 1413 ms 78520 KB Output isn't correct
8 Correct 1409 ms 78556 KB Output is correct