#include<bits/stdc++.h>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
b++;
vector <int> v(b);
for(int i = 1; i < b; i++)
{
int j = i + i;
while(j < b)
{
v[j] += i;
j += i;
}
}
long long ans = 0;
for(int i = a; i < b; i++)
ans += abs(v[i] - i);
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
3 ms |
760 KB |
Output is correct |
4 |
Correct |
1283 ms |
39512 KB |
Output is correct |
5 |
Correct |
1298 ms |
39532 KB |
Output is correct |
6 |
Correct |
1278 ms |
39512 KB |
Output is correct |
7 |
Correct |
1176 ms |
36460 KB |
Output is correct |
8 |
Correct |
228 ms |
10376 KB |
Output is correct |