Submission #1162059

#TimeUsernameProblemLanguageResultExecution timeMemory
1162059nguyenkhangninh99Savrsen (COCI17_savrsen)C++20
120 / 120
1027 ms78712 KiB
#include "bits/stdc++.h" using namespace std; using i64 = long long; #ifdef LOCAL #include "debug.h" #else #define debug(...) 42 #endif const int N = 1e7 + 7; i64 f[N]; int main() { cin.tie(0)->sync_with_stdio(0); int a, b; cin >> a >> b; for (int i = 1; i <= b; i++) { for (int j = i; j <= b; j += i) { f[j] += i; } f[i] = abs(i - (f[i] - i)) + f[i - 1]; } cout << f[b] - f[a - 1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...