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

pow

関数 · 形式的冪級数 (FPS)

// (1)
template <internal::static_modint_c mint>
std::vector<mint> pow(const std::vector<mint> &h, std::int64_t m, int deg);

// (2)
template <internal::static_modint_c mint>
std::vector<mint> pow(const std::vector<mint> &h, std::int64_t m);

概要

(1) 冪乗 $h^m \pmod{x^{deg}}$

最低次の項 $c x^k$ を括り出し $h^m = \exp(m \log(h / (c x^k))) \cdot c^m \cdot x^{km}$ で求める。 $m$ が負なら $h^{|m|}$ の逆元を返す(h[0] != 0 が必要)。最低次が $x^k$ のとき $x^{km}$ が deg 以上に押し出される場合や全係数 $0$ の場合は全 $0$ を返す。

(2) 冪乗 $h^m$(deg は h.size())

関連項目