#include <bits/stdc++.h>
#define TASK "coci1617_r6_savrsen"
#define int long long
#define fi first
#define se second
#define pb push_back
#define ii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<ii>
#define reset(f, x) memset(f, x, sizeof(f))
#define all(x) x.begin(), x.end()
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define FORV(v, H) for (auto &v: H)
#define __builtin_popcount __builtin_popcountll
#define BIT(mask, i) (mask & (1ll << (i)))
#define MASK(i) (1ll << (i))
#define ONBIT(mask, i) (mask (1ll << (i)))
#define OFFBIT(mask, i) (mask &~ (1ll << (i)))
#define mid(l,r) ((l + r) >> 1)
#define left(id) (id << 1)
#define right(id) ((id << 1) | 1)
#define TIME (1.0*clock()/CLOCKS_PER_SEC)
using namespace std;
const int oo = 1e18;
const int MOD = 1e9 + 7;
const int MAXN = 1e7;
int A, B;
int uoc[MAXN + 5];
void INIT(){
FOR(i, 1, MAXN){
FOR(j, i, MAXN / i)
if (i != j) uoc[i * j] += (j + i);
else uoc[i * j] += i;
}
}
main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> A >> B;
INIT();
int res = 0;
FOR(i, A, B) res += abs(uoc[i] - 2 * i);
cout << res;
return 0;
}
Compilation message (stderr)
savrsen.cpp:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
44 | main(){
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |