algo — C++23 日本語リファレンス GitHub

test/yosupo/number_theory/factorize.test.cpp

AC · 最終更新 2026-10-23 · GitHub

問題: https://judge.yosupo.jp/problem/factorize

依存するヘッダ(5)
実装
// competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/factorize
#include <cstdint>
#include <iostream>
#include "number_theory/factorize.hpp"

int main(void) {
    int q;
    std::cin >> q;
    while (q--) {
        std::int64_t x;
        std::cin >> x;
        auto v = factorize(x);
        std::cout << v.size();
        for (auto e : v) std::cout << ' ' << e;
        std::cout << '\n';
    }

    return 0;
}