rcpl

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

View the Project on GitHub ruthen71/rcpl

:heavy_check_mark: math/divisor.hpp

Verified with

Code

#pragma once

template <class T> std::vector<T> divisor(const T n) {
    std::vector<T> res;
    for (T i = T(1); i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i * i != n) res.push_back(n / i);
        }
    }
    std::sort(res.begin(), res.end());
    return res;
}
#line 2 "math/divisor.hpp"

template <class T> std::vector<T> divisor(const T n) {
    std::vector<T> res;
    for (T i = T(1); i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i * i != n) res.push_back(n / i);
        }
    }
    std::sort(res.begin(), res.end());
    return res;
}
Back to top page