Submission #695186

#TimeUsernameProblemLanguageResultExecution timeMemory
695186TAhmed33Savrsen (COCI17_savrsen)C++98
120 / 120
1189 ms78668 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define endl '\n'
const int MOD = 1e9 + 7;
int divs[10000001] = {};

signed main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	for (int i = 1; i <= 1e7; i++) {
		for (int j = 2 * i; j <= 1e7; j += i) {
			divs[j] += i;
		}
	}
	int a, b;
	cin >> a >> b;
	int sum = 0;
	for (int i = a; i <= b; i++) sum += abs(i - divs[i]);
		cout << sum << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...