#include <bits/stdc++.h>
using namespace std;
int a,b;
long long int sum[10000008];
long long int ans;
int main(){
cin>>a>>b;
for(int i=1;i<=b;i++){
for(int j=i;j<=b;j+=i){
sum[j]+=i;
}
}
for(int i=a;i<=b;i++){
ans=ans+abs(i+i-sum[i]);
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
7 ms |
1152 KB |
Output is correct |
4 |
Correct |
2842 ms |
78680 KB |
Output is correct |
5 |
Correct |
2776 ms |
78712 KB |
Output is correct |
6 |
Correct |
2820 ms |
78584 KB |
Output is correct |
7 |
Correct |
2548 ms |
72480 KB |
Output is correct |
8 |
Correct |
391 ms |
20316 KB |
Output is correct |