답안 #147584

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147584 2019-08-30T07:31:46 Z KCSC Savrsen (COCI17_savrsen) C++14
120 / 120
1649 ms 39564 KB
#include <bits/stdc++.h>
using namespace std;

const int DIM = 10000005;

int arr[DIM];

int main(void) {
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= b; ++i) {
        arr[i] -= i;
        for (int j = i + i; j <= b; j += i)
            arr[j] += i;
    }
    long long s = 0;
    for (int i = a; i <= b; ++i)
        s += (arr[i] >= 0 ? arr[i] : -arr[i]);
    cout << s;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 296 KB Output is correct
3 Correct 6 ms 760 KB Output is correct
4 Correct 1486 ms 39564 KB Output is correct
5 Correct 1649 ms 39500 KB Output is correct
6 Correct 1429 ms 39528 KB Output is correct
7 Correct 1249 ms 36472 KB Output is correct
8 Correct 135 ms 10360 KB Output is correct