Submission #494308

#TimeUsernameProblemLanguageResultExecution timeMemory
494308Christopher_Savrsen (COCI17_savrsen)C++17
30 / 120
3070 ms292 KiB
#include <bits/stdc++.h>

using namespace std;

int div(int x) {
    if (x == 1) return 0;
    int res = 0;
    for (int i = 2; i <= sqrt(x); ++i) {
        if (x % i == 0) {
            res += i;
            if (x / i != i) {
                res += x / i;
            }
        }
    }
    //cout << x << ' ' << res << '\n';
    return res + 1;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for (int i = a; i <= b; ++i) {
        ans += abs(i - div(i));
    }
    cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...