#include <iostream>
#include <cmath>
using namespace std;
long long a,b,i,j,sol,d[10000010];
int main() {
cin>>a>>b;
for (i=1;i<=b;i++) {
for (j=2*i;j<=b;j+=i)
d[j]+=i;
if (i>=a)
sol+=abs(i-d[i]);
}
cout<<sol;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
1148 KB |
Output is correct |
4 |
Correct |
1921 ms |
78584 KB |
Output is correct |
5 |
Correct |
1920 ms |
78636 KB |
Output is correct |
6 |
Correct |
1957 ms |
78640 KB |
Output is correct |
7 |
Correct |
1702 ms |
72568 KB |
Output is correct |
8 |
Correct |
222 ms |
20216 KB |
Output is correct |