#include<bits/stdc++.h>
#define rep(i, a, b) for(int i=(a) ; i<=(b) ; ++i)
#define Task ""
using namespace std;
const int N=10000005;
long long d[N];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(Task".inp", "r", stdin);
//freopen(Task".out", "w", stdout);
int a, b;
cin >> a >> b;
rep(i, 1, b/2) {
for(int j=i*2 ; j<=b ; j+=i) d[j]+=i;
}
long long ans=0;
rep(i, a, b) {
ans+=abs(i-d[i]);
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
6 ms |
1356 KB |
Output is correct |
4 |
Correct |
2133 ms |
78952 KB |
Output is correct |
5 |
Correct |
2158 ms |
78952 KB |
Output is correct |
6 |
Correct |
2019 ms |
78952 KB |
Output is correct |
7 |
Correct |
1784 ms |
78952 KB |
Output is correct |
8 |
Correct |
223 ms |
78952 KB |
Output is correct |