# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
76594 | charlies_moo | Savrsen (COCI17_savrsen) | C++98 | 912 ms | 39824 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
long long ans=0;
int sum[10000001];
int main()
{
int a,b;
cin>>a>>b;
for(int i=a;i<=b;++i)
sum[i]=1;
sum[1]=0;
int upb=sqrt(b);
for(int i=2;i<=upb;++i)
for(int j=a/i;j<=b/i;++j)
{
if(i>j)
continue;
sum[j*i]=(j>1) ? (sum[j*i]+i) : sum[j*i];
sum[j*i]+=j;
sum[j*i]=(i==j) ? (sum[j*i]-i) : sum[j*i];
}
for(int i=a;i<=b;++i)
ans+=abs(sum[i]-i);
cout<<ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |