답안 #918912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918912 2024-01-30T18:02:14 Z phamducminh Savrsen (COCI17_savrsen) C++17
120 / 120
1158 ms 78928 KB
//******************/
//*   I<3   C++    */
//*  I WANT ANY AC */
//* I LOVE PROGRAM!*/
//*IT'S long longERESTING*/
//* I LOVE PROGRAM!*/
//*  IN CONTESTS   */
//*   GET SCORE    */
//*    AC CODE     */
//*     LET'S      */
//*      GO        */
//*  Written by:   */
//*   Duc Minh     */






#include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <algorithm>
#include <string>
#include <queue>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <deque>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define  file(name)  freopen(name".inp", "r", stdin);\
                     freopen(name".out", "w", stdout);
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define TIME        (1.0 * clock() / CLOCKS_PER_SEC)
#define all(a)      a.begin(),a.end()
#define endl        "\n"
#define all1(a)     a+1,a+n+1
// #define unordered_map  map
// #define push_back   emplace_back
// #define gcd(a,b)    __gcd(a,b);
// #define lcm(a,b)    (a*b)/gcd(a,b);

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9+7;
const long long MODD = 1e9; /// 998244353
const long long maxN = 25009;






///--------------------------------


void solve();

signed main(){

    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


    // file("tbrackets");







    long long t;


    // cin >> t;

    t=1;



    while (t--){




        solve();


    }





    cerr << "Time elapsed: " << TIME << "s.\n";
    cerr << "ducminh" << "\n";
    return 0;
}



///--------------------[PROBLEM SOLUTION]--------------------///


long long l,r;
long long f[10000009];


void sub5(){

    
    for (long long i=1; i<=1e7; i++){

        for (long long j=2*i; j<=1e7; j+=i){
            f[j]+=i;
        }
    }


    long long ans=0;
    for (long long i=l; i<=r; i++){

        ans+=abs(i-f[i]);
    }

    cout << ans;


}

void solve(){

    
    
    

    cin >> l >> r;

    

    

    sub5();
}








# 결과 실행 시간 메모리 Grader output
1 Correct 1158 ms 78712 KB Output is correct
2 Correct 1146 ms 78928 KB Output is correct
3 Correct 1131 ms 78680 KB Output is correct
4 Correct 1126 ms 78712 KB Output is correct
5 Correct 1151 ms 78928 KB Output is correct
6 Correct 1128 ms 78928 KB Output is correct
7 Correct 1150 ms 78712 KB Output is correct
8 Correct 1115 ms 78712 KB Output is correct