#include<bits/stdc++.h>
using namespace std;
#define int long long
int sum[10000005];
signed main(){
int n,m; cin>>n>>m;
for(int i=2;i<=10000000;i++){
for(int j=i+i;j<=10000000;j+=i) sum[j]+=i;
}
int ans=0;
for(int i=n;i<=m;i++){
ans+=abs(i-sum[i]-(i==1? 0:1));
// cout<<abs(i-sum[i]-(i==1? 0:1))<<endl;
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
538 ms |
78688 KB |
Output is correct |
2 |
Correct |
525 ms |
78680 KB |
Output is correct |
3 |
Correct |
518 ms |
78684 KB |
Output is correct |
4 |
Correct |
549 ms |
78684 KB |
Output is correct |
5 |
Correct |
565 ms |
78692 KB |
Output is correct |
6 |
Correct |
572 ms |
78688 KB |
Output is correct |
7 |
Correct |
592 ms |
78684 KB |
Output is correct |
8 |
Correct |
566 ms |
78684 KB |
Output is correct |