Submission #82757

#TimeUsernameProblemLanguageResultExecution timeMemory
82757heonSavrsen (COCI17_savrsen)C++11
120 / 120
1590 ms39728 KiB
#include<bits/stdc++.h>

using namespace std;

const int MAXN = 1e7 + 5;

int v[MAXN];

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b;
	cin >> a >> b;
	for(int i = 1; i <= b; i++){
		for(int j = i + i; j <= b; j += i){
			v[j] += i;
		}
	}
	long long sum = 0;
	for(int i = a; i <= b; i++){
		sum += abs(i - v[i]); 
		//cout << abs(i - v[i]) << " ";
	}
	cout << sum;
}
#Verdict Execution timeMemoryGrader output
Fetching results...