Submission #147822

# Submission time Handle Problem Language Result Execution time Memory
147822 2019-08-30T19:51:32 Z mariadinca Savrsen (COCI17_savrsen) C++14
120 / 120
2045 ms 78712 KB
#include <iostream>

using namespace std;

int a, b, i, j;
long long x, sol, sum[10000001];

int main(){
    cin>>a>>b;
    if(a == 1)
        sol = 1;
    for(i=2;i<=b;i++){
        for(j=i+i;j<=b;j+=i)
            sum[j] += i;
        x = sum[i] + 1 - i;
        x = max(x, -x);
        if(i >= a)
            sol += x;
    }
    cout<<sol;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 6 ms 1144 KB Output is correct
4 Correct 2045 ms 78636 KB Output is correct
5 Correct 1927 ms 78684 KB Output is correct
6 Correct 1934 ms 78712 KB Output is correct
7 Correct 1788 ms 72568 KB Output is correct
8 Correct 236 ms 20216 KB Output is correct