Submission #1062806

#TimeUsernameProblemLanguageResultExecution timeMemory
1062806dimasnbayuSavrsen (COCI17_savrsen)C++14
120 / 120
592 ms78692 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int sum[10000005]; signed main(){ int n,m; cin>>n>>m; for(int i=2;i<=10000000;i++){ for(int j=i+i;j<=10000000;j+=i) sum[j]+=i; } int ans=0; for(int i=n;i<=m;i++){ ans+=abs(i-sum[i]-(i==1? 0:1)); // cout<<abs(i-sum[i]-(i==1? 0:1))<<endl; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...