답안 #494309

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
494309 2021-12-15T05:07:04 Z Christopher_ Savrsen (COCI17_savrsen) C++17
60 / 120
3000 ms 304 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int div(int x) {
    if (x == 1) return 0;
    int res = 0;
    for (int i = 2; i <= sqrt(x); ++i) {
        if (x % i == 0) {
            res += i;
            if (x / i != i) {
                res += x / i;
            }
        }
    }
    //cout << x << ' ' << res << '\n';
    return res + 1;
}
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for (int i = a; i <= b; ++i) {
        ans += abs(i - div(i));
    }
    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 141 ms 204 KB Output is correct
4 Correct 23 ms 304 KB Output is correct
5 Execution timed out 3063 ms 204 KB Time limit exceeded
6 Execution timed out 3084 ms 204 KB Time limit exceeded
7 Execution timed out 3059 ms 204 KB Time limit exceeded
8 Execution timed out 3068 ms 204 KB Time limit exceeded