#include <iostream>
#include <vector>
using namespace std;
int abs(int x) { return x > 0 ? x : -x; }
int main() {
int a, b;
cin >> a >> b;
int M = b + 1;
vector<int> v(M);
for (int d = 1; d < M; ++d) {
int dd = d + d;
while (dd < M) {
v[dd] += d;
dd += d;
}
}
long long s = 0;
for (int i = a; i <= b; ++i)
s += abs(v[i] - i);
cout << s << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
646 ms |
39564 KB |
Output is correct |
5 |
Correct |
643 ms |
39560 KB |
Output is correct |
6 |
Correct |
654 ms |
39564 KB |
Output is correct |
7 |
Correct |
582 ms |
36484 KB |
Output is correct |
8 |
Correct |
32 ms |
10332 KB |
Output is correct |