답안 #908586

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908586 2024-01-16T14:45:59 Z andro Savrsen (COCI17_savrsen) C++14
120 / 120
1234 ms 78932 KB
#include <bits/stdc++.h>

#define int long long

using namespace std;

const int N = 1e7 + 5;

vector<int> divs(N);

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    for(int i = 1; i < N; i++) {
        for(int j = i + i; j < N; j+=i) {
            divs[j] += i;
        }
    }
    int l, r;
    cin >> l >> r;
    int ans = 0;
    for(int i = l; i <= r; i++) {
        ans += abs(i - divs[i]);
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1147 ms 78744 KB Output is correct
2 Correct 1234 ms 78720 KB Output is correct
3 Correct 1229 ms 78720 KB Output is correct
4 Correct 1162 ms 78720 KB Output is correct
5 Correct 1183 ms 78680 KB Output is correct
6 Correct 1167 ms 78932 KB Output is correct
7 Correct 1145 ms 78716 KB Output is correct
8 Correct 1196 ms 78720 KB Output is correct