답안 #466921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
466921 2021-08-21T03:17:29 Z dvtd Savrsen (COCI17_savrsen) C++14
120 / 120
1296 ms 39492 KB
#include <bits/stdc++.h>
#define maxN 10000010

using namespace std;

int sum[maxN];

int main()
{
    int a, b;
    cin >> a >> b;

    for (int d = 1; d <= b; ++d)
    {
        int mul = 2;

        while (mul <= b / d)
        {
            sum[d * mul] += d;
            mul++;
        }
    }

    long long res = 0;
    for (int i = a; i <= b; ++i) res += abs(sum[i] - i);

    cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1281 ms 39408 KB Output is correct
5 Correct 1290 ms 39404 KB Output is correct
6 Correct 1296 ms 39492 KB Output is correct
7 Correct 1226 ms 36336 KB Output is correct
8 Correct 224 ms 10228 KB Output is correct