Skip to content

Commit 2bf5855

Browse files
committed
Fix document
1 parent e1ede10 commit 2bf5855

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

number/combination.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ title: Combination (${}_n \mathrm{C}_r \bmod{m}$,Lucas の定理の拡張)
33
documentation_of: ./combination.hpp
44
---
55

6-
固定された正整数 $m = p\_1^{q\_1} \dots p\_{k}^{1\_k} ( \le 10^7)$ について,$\binom{n}{r} \bmod{m}$ の値を計算する.前計算 $O(\sum_i p\_i^{q\_i})$,クエリ $O(k \mathrm{log}(n))$.
6+
固定された正整数 $m = p\_1^{q\_1} \dots p\_{k}^{q\_k} ( \le 10^7)$ について,$\binom{n}{r} \bmod{m}$ の値を計算する.前計算 $O(\sum_i p\_i^{q\_i})$,クエリ $O(k \mathrm{log}(n))$.
77

88
## 原理
99

1010
$m$ を素因数分解し,各素数冪 $p^q$ を法とした $\binom{n}{r}$ の値を拡張 Lucas の定理を用いて計算し,中国剰余定理を用いて解を復元する.
1111

1212
## 使用方法
1313

14-
コンストラクタには法 $m$ を素因数分解した結果の(素数,次数)の組として(例:`vector<pair<int, int>>`, `map<int, int>` )与える.例えば $\bmod{60}$ で計算したい場合は `{{2, 2}, {3, 1}, {5, 1}}` を与えればよい.また,本ライブラリの `Sieve` クラスの `factorize()` が返す結果をそのまま渡してもよい:
14+
コンストラクタには法 $m$ を素因数分解した結果の(素数,次数)の組として(例:`vector<pair<int, int>>`, `map<int, int>` )与える.例えば $\bmod{60}$ で計算したい場合は `{2, 2}, {3, 1}, {5, 1}` を与えればよい.また,本ライブラリの `Sieve` クラスの `factorize()` が返す結果をそのまま渡してもよい:
1515

1616
```cpp
1717
combination nCr(Sieve(1 << 20).factorize(mod));

0 commit comments

Comments
 (0)