제출 #100743

#제출 시각아이디문제언어결과실행 시간메모리
100743dalgerokSavrsen (COCI17_savrsen)C++17
120 / 120
1772 ms39800 KiB
#include<bits/stdc++.h>
using namespace std;


const int N = 1e7 + 1;


int dp[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    for(int i = 1; i < N; i++){
        for(int j = 2 * i; j < N; j += i){
            dp[j] += i;
        }
    }
    int l, r;
    cin >> l >> r;
    long long ans = 0;
    for(int i = l; i <= r; i++){
        ans += abs(i - dp[i]);
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...