#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*i<=10000000;i++){
for(int j=i+i;j<=m;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 |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
2 ms |
2652 KB |
Output isn't correct |
4 |
Incorrect |
315 ms |
78680 KB |
Output isn't correct |
5 |
Incorrect |
322 ms |
78684 KB |
Output isn't correct |
6 |
Incorrect |
329 ms |
78680 KB |
Output isn't correct |
7 |
Incorrect |
297 ms |
72532 KB |
Output isn't correct |
8 |
Incorrect |
50 ms |
20320 KB |
Output isn't correct |