#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MAXN = 1e7+1;
ll a,b,res;
ll sumDiv[MAXN];
int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);
cin>>a>>b;
for(int i=1;i<=b;i++){
for(int j=i;j<=b;j+=i)
sumDiv[j]+=i;
}
for(;a<=b;a++) res += abs(2*a - sumDiv[a]);
cout<<res;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
7 ms |
1232 KB |
Output is correct |
4 |
Correct |
2196 ms |
78932 KB |
Output is correct |
5 |
Correct |
2145 ms |
79112 KB |
Output is correct |
6 |
Correct |
2167 ms |
79112 KB |
Output is correct |
7 |
Correct |
1882 ms |
79112 KB |
Output is correct |
8 |
Correct |
262 ms |
79112 KB |
Output is correct |