//#include<fstream>
#include<queue>
#include<algorithm>
#include<iostream>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("date.in");
//ofstream fout("date.out");
int a,b,i,f[10000001],j;
long long sol;
int main()
{
fin>>a>>b;
for(i=1;i<=b;i++)
{
f[i]-=i;
for(j=i*2;j<=b;j+=i)
f[j]+=i;
}
for(i=a;i<=b;i++)
if(f[i]>0) sol+=f[i]; else sol-=f[i];
fout<<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 |
5 ms |
760 KB |
Output is correct |
4 |
Correct |
1631 ms |
39496 KB |
Output is correct |
5 |
Correct |
1519 ms |
39504 KB |
Output is correct |
6 |
Correct |
1593 ms |
39544 KB |
Output is correct |
7 |
Correct |
1367 ms |
36424 KB |
Output is correct |
8 |
Correct |
144 ms |
10240 KB |
Output is correct |