답안 #322393

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
322393 2020-11-14T15:01:16 Z fgojko Savrsen (COCI17_savrsen) C++14
120 / 120
1327 ms 39508 KB
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    vector<int> vec(b+1, 0);
    for(int i = 1; i <= b/2+1; ++i){
        for(int j = i*2; j <= b; j += i){
            vec[j] += i;
        }
    }
    long long sum = 0;
    for(int i = a; i <= b; ++i){
        sum += abs(vec[i] - i);
    }
    cout << sum << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 2 ms 748 KB Output is correct
4 Correct 1305 ms 39424 KB Output is correct
5 Correct 1327 ms 39508 KB Output is correct
6 Correct 1294 ms 39508 KB Output is correct
7 Correct 1201 ms 36460 KB Output is correct
8 Correct 228 ms 10220 KB Output is correct