/*
https://oj.uz/problem/view/COCI17_savrsen
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
vector<int> vec(b+1,0);
for(int i=1;i<=b;i++)
{
for(int j=i;j<=b;j+=i)
{
vec[j]+=i;
}
}
long long ans=0;
for(int i=a;i<=b;i++)
{
ans+=(llabs(i-(vec[i]-i)));
}
cout<<ans<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
588 KB |
Output is correct |
4 |
Correct |
1230 ms |
39428 KB |
Output is correct |
5 |
Correct |
1101 ms |
39428 KB |
Output is correct |
6 |
Correct |
1172 ms |
39424 KB |
Output is correct |
7 |
Correct |
1146 ms |
36412 KB |
Output is correct |
8 |
Correct |
197 ms |
10188 KB |
Output is correct |