답안 #884459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
884459 2023-12-07T11:53:36 Z Ariadna Savrsen (COCI17_savrsen) C++14
120 / 120
770 ms 78932 KB
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    vector < ll > sum(b + 1, 1);
    sum[1] = 0;
    for (int i = 2; i <= b; ++i) {
        for (int j = 2 * i; j <= b; j += i) {
            sum[j] += i;
        }
    }
    ll ans = 0;
    for (int i = a; i <= b; ++i) {
        ans += abs(sum[i] - i);
    }
    cout << ans << '\n';
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 1116 KB Output is correct
4 Correct 770 ms 78716 KB Output is correct
5 Correct 740 ms 78696 KB Output is correct
6 Correct 765 ms 78932 KB Output is correct
7 Correct 683 ms 72540 KB Output is correct
8 Correct 146 ms 20316 KB Output is correct