답안 #480569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
480569 2021-10-17T06:06:02 Z varungoyalbits Savrsen (COCI17_savrsen) C++17
120 / 120
1230 ms 39428 KB
/*
https://oj.uz/problem/view/COCI17_savrsen
*/

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    vector<int> vec(b+1,0);
    for(int i=1;i<=b;i++)
    {
        for(int j=i;j<=b;j+=i)
        {
            vec[j]+=i;
        }
    }
    long long ans=0;
    for(int i=a;i<=b;i++)
    {
        ans+=(llabs(i-(vec[i]-i)));
    }
    cout<<ans<<"\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1230 ms 39428 KB Output is correct
5 Correct 1101 ms 39428 KB Output is correct
6 Correct 1172 ms 39424 KB Output is correct
7 Correct 1146 ms 36412 KB Output is correct
8 Correct 197 ms 10188 KB Output is correct