제출 #1107149

#제출 시각아이디문제언어결과실행 시간메모리
1107149toast12Savrsen (COCI17_savrsen)C++14
120 / 120
523 ms78708 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    vector<long long> sum(b+1);
    for (int i = 2; i <= b; i++) {
        for (int j = i+i; j <= b; j += i) sum[j] += i;
        sum[i]++;
    }
    long long ans = 0;
    for (int i = a; i <= b; i++) ans += abs(i-sum[i]);
    cout << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...