제출 #318468

#제출 시각아이디문제언어결과실행 시간메모리
318468ignaciocantaSavrsen (COCI17_savrsen)C++14
30 / 120
1296 ms39652 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
using tint = long long;
using ld = long double;
 
#define forsn(i, s, n) for(int i = s; i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
 
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define rall(x) x.rbegin(), x.rend() 
#define sz(x) (int)(x).size()
 
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
 
#define DBG(x) cerr << #x << " = " << x << endl;
 
const int MOD = 1e9+7;
const int MX = 1e5+5;
const tint INF = 1e18;
const int inf = 2e9;
const ld PI = acos(ld(-1)); 

void NACHO(string name = "moop"){
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen((name+".in").c_str(), "r", stdin);
    //freopen((name+".out").c_str(), "w", stdout);
}

struct pt{
	int x, y;
	bool operator<(const pt &o)const{
		if(x == o.x) return y < o.y;
		return x < o.x;
	}
};

int main(){
	NACHO();
	int a, b;
	cin >> a >> b;
	vi sum (b+1, 0);
	forsn(i, 1, b+1){
		for(int j = i+i; j <= b; j+=i){
			sum[j]+=i;
		}
	}
	int tot = 0;
	forsn(i, a, b+1){
		tot+=abs(i-sum[i]);
	}
	cout << tot << endl;
	//pensa que si vas por todas las rectas horizontales de arriba p abajo,
	//podes considerar a todos los puntos en se recta con los puntos en los extremos.
	
}
#Verdict Execution timeMemoryGrader output
Fetching results...