제출 #1236665

#제출 시각아이디문제언어결과실행 시간메모리
1236665overwatch9Savrsen (COCI17_savrsen)C++20
120 / 120
928 ms78692 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int a, b;
    cin >> a >> b;
    vector <ll> sum(b+1);
    for (int i = 2; i <= b; i++) {
        for (int j = i+i; j <= b; j += i)
            sum[j] += i;
        sum[i]++;
    }
    ll ans = 0;
    for (int i = a; i <= b; i++)
        ans += abs(i - sum[i]);
    cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...