답안 #1062806

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1062806 2024-08-17T10:56:29 Z dimasnbayu Savrsen (COCI17_savrsen) C++14
120 / 120
592 ms 78692 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
int sum[10000005];
signed main(){
    int n,m; cin>>n>>m;
    for(int i=2;i<=10000000;i++){
        for(int j=i+i;j<=10000000;j+=i) sum[j]+=i;
    }
    int ans=0;
    for(int i=n;i<=m;i++){
        ans+=abs(i-sum[i]-(i==1? 0:1));
        // cout<<abs(i-sum[i]-(i==1? 0:1))<<endl;
    }
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 538 ms 78688 KB Output is correct
2 Correct 525 ms 78680 KB Output is correct
3 Correct 518 ms 78684 KB Output is correct
4 Correct 549 ms 78684 KB Output is correct
5 Correct 565 ms 78692 KB Output is correct
6 Correct 572 ms 78688 KB Output is correct
7 Correct 592 ms 78684 KB Output is correct
8 Correct 566 ms 78684 KB Output is correct