competitive-cpp

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub fiore57/competitive-cpp

:warning: math/divisor.cpp

Back to top page

Code

vector<ll> divisor(const ll n) {
    vector<ll> ret;
    for (std::int64_t i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

#line 1 "math/divisor.cpp"
vector<ll> divisor(const ll n) {
    vector<ll> ret;
    for (std::int64_t i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

Back to top page