Submission #466900

#TimeUsernameProblemLanguageResultExecution timeMemory
4669001e9dSavrsen (COCI17_savrsen)C++14
120 / 120
1550 ms78608 KiB
#include <bits/stdc++.h>
using namespace std;

long long mp[10000001];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //freopen("ws.INP", "r", stdin);
	//freopen("ws.OUT", "w", stdout);

	memset(mp, 0, sizeof mp);
	int a, b; cin >> a >> b;
	long long res = 0;
    for (int i = 1; i <= b; i++) {
        mp[i] += i;
        if (i >= a) res += abs(mp[i]);
        for (int j = i * 2; j <= b; j += i)
            mp[j] -= i;
    } cout << res;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...