#pragma once #include <algorithm> #include <vector> namespace haar_lib { std::vector<int64_t> enumerate_divisors(int64_t n) { std::vector<int64_t> temp, ret; { int64_t i; for (i = 1LL; i * i < n; ++i) { if (n % i == 0) { temp.push_back(n / i); ret.push_back(i); } } if (i * i == n) ret.push_back(i); } std::reverse(temp.begin(), temp.end()); ret.insert(ret.end(), temp.begin(), temp.end()); return ret; } } // namespace haar_lib
#line 2 "Mylib/Number/Divisor/enumerate_divisors.cpp" #include <algorithm> #include <vector> namespace haar_lib { std::vector<int64_t> enumerate_divisors(int64_t n) { std::vector<int64_t> temp, ret; { int64_t i; for (i = 1LL; i * i < n; ++i) { if (n % i == 0) { temp.push_back(n / i); ret.push_back(i); } } if (i * i == n) ret.push_back(i); } std::reverse(temp.begin(), temp.end()); ret.insert(ret.end(), temp.begin(), temp.end()); return ret; } } // namespace haar_lib