제출 #974587

#제출 시각아이디문제언어결과실행 시간메모리
974587vjudge1Savrsen (COCI17_savrsen)C++17
120 / 120
776 ms39764 KiB
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define sz(x) (ll)x.size()
using namespace std;
int tt[10000005]{0};
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a,b;cin>>a>>b;
    for(int i=1;i<=b;i++){
        for(int j=2*i;j<=b;j+=i)tt[j]+=i;
    }ll ans=0;
    for(int i=a;i<=b;i++)ans+=abs(i-tt[i]);
    cout<<ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...