#include <bits/stdc++.h>
using namespace std;
int div(int x) {
if (x == 1) return 0;
int res = 0;
for (int i = 2; i <= sqrt(x); ++i) {
if (x % i == 0) {
res += i;
if (x / i != i) {
res += x / i;
}
}
}
//cout << x << ' ' << res << '\n';
return res + 1;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a, b;
cin >> a >> b;
int ans = 0;
for (int i = a; i <= b; ++i) {
ans += abs(i - div(i));
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
146 ms |
288 KB |
Output isn't correct |
4 |
Incorrect |
23 ms |
292 KB |
Output isn't correct |
5 |
Execution timed out |
3050 ms |
204 KB |
Time limit exceeded |
6 |
Execution timed out |
3046 ms |
204 KB |
Time limit exceeded |
7 |
Execution timed out |
3058 ms |
204 KB |
Time limit exceeded |
8 |
Execution timed out |
3070 ms |
204 KB |
Time limit exceeded |