Submission #884462

# Submission time Handle Problem Language Result Execution time Memory
884462 2023-12-07T12:06:19 Z gutzzy Savrsen (COCI17_savrsen) C++14
120 / 120
659 ms 39560 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    long long ans = 0;
    
    vector<int> dv(b+1,0);
    
    for(int i=1; i<b+1; i++){
        for(int pos=i; pos<b+1; pos+=i){
            if(i!=pos) dv[pos] += i;
        }
    }
    for(int i=a; i<=b; i++)ans += abs(i-dv[i]);
    
    cout << ans << endl;
    
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 620 ms 39560 KB Output is correct
5 Correct 659 ms 39560 KB Output is correct
6 Correct 613 ms 39516 KB Output is correct
7 Correct 629 ms 36480 KB Output is correct
8 Correct 32 ms 10328 KB Output is correct