Submission #1244839

#TimeUsernameProblemLanguageResultExecution timeMemory
1244839warrennSavrsen (COCI17_savrsen)C++20
120 / 120
903 ms78688 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long 

const int maxn=1e7;
int tot[maxn+1];

signed main(){
    for(int q=1;q<=maxn;q++){
        for(int w=2*q;w<=maxn;w+=q){
            tot[w]+=q;
        }
    }
    int l,r;
    cin>>l>>r;
    int ans=0;
    for(int q=l;q<=r;q++){
        ans+=abs(tot[q]-q);
    }
    cout<<ans<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...