#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
ll a,b;
cin>>a>>b;
ll zbirdelilaca[b+1];
for(ll i=a;i<=b;i++) zbirdelilaca[i]=0;
for(ll i=1;i<=b;i++)
{
ll sta=2*i;
while(sta<a) sta+=i;
while(sta<=b)
{
zbirdelilaca[sta]+=i;
sta+=i;
}
}
ll kolko=0;
for(ll i=a;i<=b;i++) kolko+=abs(i-zbirdelilaca[i]);
cout<<kolko<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
1152 KB |
Output is correct |
4 |
Correct |
91 ms |
376 KB |
Output is correct |
5 |
Correct |
1487 ms |
70808 KB |
Output is correct |
6 |
Correct |
1740 ms |
78636 KB |
Output is correct |
7 |
Correct |
1656 ms |
71368 KB |
Output is correct |
8 |
Correct |
314 ms |
20344 KB |
Output is correct |