Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
387 B
1
Indexable
Never
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    long long n;
    cin >> n;
    long long sum = 0;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
            sum += i;
        if (n / i != i)
            sum += n / i;
    }

    cout << sum << endl;
    return 0;
}