Submission #494331

#TimeUsernameProblemLanguageResultExecution timeMemory
494331Christopher_Savrsen (COCI17_savrsen)C++17
120 / 120
1047 ms78540 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; vector<ll> dp(b + 1); for (int i = 1; i <= b; ++i) { for (int j = i * 2; j <= b; j += i) { dp[j] += i; } } ll res = 0; for (int i = a; i <= b; ++i) { res += abs(i - dp[i]); } cout << res << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...