답안 #100743

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100743 2019-03-13T20:18:51 Z dalgerok Savrsen (COCI17_savrsen) C++17
120 / 120
1772 ms 39800 KB
#include<bits/stdc++.h>
using namespace std;


const int N = 1e7 + 1;


int dp[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    for(int i = 1; i < N; i++){
        for(int j = 2 * i; j < N; j += i){
            dp[j] += i;
        }
    }
    int l, r;
    cin >> l >> r;
    long long ans = 0;
    for(int i = l; i <= r; i++){
        ans += abs(i - dp[i]);
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1516 ms 39544 KB Output is correct
2 Correct 1635 ms 39544 KB Output is correct
3 Correct 1772 ms 39416 KB Output is correct
4 Correct 1554 ms 39544 KB Output is correct
5 Correct 1598 ms 39544 KB Output is correct
6 Correct 1618 ms 39800 KB Output is correct
7 Correct 1629 ms 39516 KB Output is correct
8 Correct 1568 ms 39516 KB Output is correct