답안 #172116

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172116 2019-12-31T07:39:36 Z 0gnjen Savrsen (COCI17_savrsen) C++14
120 / 120
2061 ms 78660 KB
//Failure will never overtake me if my determination to succeed is strong enough
#include <bits/stdc++.h>

using namespace std;

long long eratosten[10000007];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int a, b;
    cin >> a >> b;


    for(int i = 1; i <= b; i++)
    {
        for(int j = 2*i; j <= b; j+=i)
        {
            eratosten[j] += i;
        }
    }

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

    cout << sum;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 352 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 6 ms 1144 KB Output is correct
4 Correct 1886 ms 78660 KB Output is correct
5 Correct 2061 ms 78656 KB Output is correct
6 Correct 2028 ms 78660 KB Output is correct
7 Correct 1719 ms 72504 KB Output is correct
8 Correct 232 ms 20216 KB Output is correct