# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
463805 | rainboy | Savrsen (COCI17_savrsen) | C11 | 1488 ms | 78608 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |