#include <iostream>
using namespace std;
int f[1010101];
int a, b;
int main () {
cin >> a >> b;
for (int i = 1; i <= b; ++i) {
int j = i + i;
while (j <= b) {
f[j] += i;
j += i;
}
}
int ans = 0;
for (int i = a; i <= b; i ++)
ans += abs(f[i] - i);
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
508 KB |
Output is correct |
3 |
Incorrect |
6 ms |
892 KB |
Output isn't correct |
4 |
Runtime error |
11 ms |
8352 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
11 ms |
8552 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
13 ms |
8560 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
11 ms |
8660 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
12 ms |
8660 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |