#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
vector<int> vec(b+1, 1);
vec[1] = 0;
for(int i = 2; i <= b/2+1; ++i){
for(int j = i*2; j <= b; j += i){
vec[j] += i;
}
}
int sum = 0;
for(int i = a; i <= b; ++i){
sum += abs(vec[i] - i);
}
cout << sum << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Incorrect |
2 ms |
748 KB |
Output isn't correct |
4 |
Incorrect |
1307 ms |
39404 KB |
Output isn't correct |
5 |
Incorrect |
1308 ms |
39508 KB |
Output isn't correct |
6 |
Incorrect |
1320 ms |
39616 KB |
Output isn't correct |
7 |
Incorrect |
1195 ms |
36460 KB |
Output isn't correct |
8 |
Incorrect |
229 ms |
10448 KB |
Output isn't correct |