#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<=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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
310 ms |
78684 KB |
Output is correct |
2 |
Correct |
299 ms |
78684 KB |
Output is correct |
3 |
Incorrect |
309 ms |
78676 KB |
Output isn't correct |
4 |
Incorrect |
310 ms |
78676 KB |
Output isn't correct |
5 |
Incorrect |
305 ms |
78676 KB |
Output isn't correct |
6 |
Incorrect |
314 ms |
78684 KB |
Output isn't correct |
7 |
Incorrect |
314 ms |
78480 KB |
Output isn't correct |
8 |
Incorrect |
317 ms |
78928 KB |
Output isn't correct |