#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 |
2020 KB |
Output is correct |
2 |
Correct |
0 ms |
2020 KB |
Output is correct |
3 |
Correct |
3 ms |
2420 KB |
Output is correct |
4 |
Correct |
1253 ms |
41084 KB |
Output is correct |
5 |
Correct |
1183 ms |
41084 KB |
Output is correct |
6 |
Correct |
1266 ms |
41084 KB |
Output is correct |
7 |
Correct |
1006 ms |
38012 KB |
Output is correct |
8 |
Correct |
129 ms |
11952 KB |
Output is correct |