#include <bits/stdc++.h>
using namespace std;
long long d[10000018],r;
int A,B;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> A >> B;
for(int i = 1; i <= B; i++){
for(int j = 2*i; j <= B; j+=i)
d[j] += i;
}
for(int i = A; i <= B; i++){
r += abs(i - d[i]);
}
cout << r;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
508 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
6 ms |
1144 KB |
Output is correct |
4 |
Correct |
1994 ms |
78656 KB |
Output is correct |
5 |
Correct |
2025 ms |
78712 KB |
Output is correct |
6 |
Correct |
2069 ms |
78752 KB |
Output is correct |
7 |
Correct |
1793 ms |
72568 KB |
Output is correct |
8 |
Correct |
305 ms |
20344 KB |
Output is correct |