#include <bits/stdc++.h>
using namespace std;
long long s[10000007];
int main()
{
int a,b;cin>>a>>b;
for(int i=1;i<=b;i++)
{
for(int j=i+i;j<=b;j+=i)
{
s[j]-=i;
}
}
long long sum=0;
for(int i=a;i<=b;i++)
{
sum+=abs(i+s[i]);
}
cout<<sum;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
1144 KB |
Output is correct |
4 |
Correct |
1794 ms |
78712 KB |
Output is correct |
5 |
Correct |
1880 ms |
78668 KB |
Output is correct |
6 |
Correct |
1782 ms |
78664 KB |
Output is correct |
7 |
Correct |
1643 ms |
72440 KB |
Output is correct |
8 |
Correct |
195 ms |
20216 KB |
Output is correct |