#include <bits/stdc++.h>
#define ll long long int
#define MaxN 10000001
using namespace std;
ll a,b,x[MaxN]={},ans=0;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>a>>b;
for (ll i=1;i<=b;i++)
for (ll j=2;j<=b/i;j++)
x[i*j]+=i;
for (ll i=a;i<=b;i++) ans+=abs(i-x[i]);
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
2652 KB |
Output is correct |
4 |
Correct |
655 ms |
78684 KB |
Output is correct |
5 |
Correct |
618 ms |
78684 KB |
Output is correct |
6 |
Correct |
627 ms |
78708 KB |
Output is correct |
7 |
Correct |
579 ms |
74484 KB |
Output is correct |
8 |
Correct |
72 ms |
21140 KB |
Output is correct |