#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
using namespace std;
int a, b;
int arr[10000005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>a>>b;
for(int i = 1;i<=10000000;i++)
{
for(int j = 2*i;j<=10000000;j+=i)
arr[j]-=i;
}
ll ans = 0;
for(int i = a;i<=b;i++)
{
ans+=abs(arr[i]+i);
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1293 ms |
39544 KB |
Output is correct |
2 |
Correct |
1284 ms |
39544 KB |
Output is correct |
3 |
Correct |
1278 ms |
39516 KB |
Output is correct |
4 |
Correct |
1298 ms |
39520 KB |
Output is correct |
5 |
Correct |
1300 ms |
39648 KB |
Output is correct |
6 |
Correct |
1309 ms |
39544 KB |
Output is correct |
7 |
Correct |
1339 ms |
39416 KB |
Output is correct |
8 |
Correct |
1298 ms |
39516 KB |
Output is correct |