This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub ei1333/library
#include "math/number-theory/divisor.hpp"
与えられた整数の約数を列挙します。
vector< int64_t > divisor(int64_t n)
n の約数を昇順に返します。
n
vector< int64_t > divisor(int64_t n) { vector< int64_t > ret; for(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(begin(ret), end(ret)); return ret; }
#line 1 "math/number-theory/divisor.hpp" vector< int64_t > divisor(int64_t n) { vector< int64_t > ret; for(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(begin(ret), end(ret)); return ret; }