Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/math/combinatorics/online-binomial-sum.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ documentation_of: math/combinatorics/online-binomial-sum.hpp
- $r=-1$ の場合は $\displaystyle F(n,m)=(-1)^{n-1}\binom{m-1}{n-1}$ を用い、 $r+1$ による除算を行わない。ただし、 $n=0$ または $m=0$ の場合は別に処理する。
- $r$ が $0$ でも $-1$ でもない場合、 $n$ 方向の遷移には境界項 $\displaystyle r^n\binom{m}{n}$ を用いる。 $m$ 方向の遷移にはパスカルの三角形の等式から得られる $\displaystyle F(n,m+1)=(r+1)F(n,m)-r^n\binom{m}{n-1}$ を用いる。
- バケットサイズ $B$ を指定しない場合、 $r=0$ であれば $B=1$ とし、既定のバケットサイズを計算しない。
- バケットサイズ $B$ を指定せず、 $r\ne 0$ の場合、 $M$ が正であれば $B^2\le M$ を満たす最大の $2$ の冪が選ばれる。 $M=0$ の場合は $B=1$ である
- バケットサイズ $B$ を指定せず、 $r\ne 0$ の場合、 $B^2>M$ を満たす最小の $2$ の冪が選ばれる。

## 使い方

Expand All @@ -36,7 +36,7 @@ documentation_of: math/combinatorics/online-binomial-sum.hpp
- $0\le m\le M$ のクエリに対する前計算を行う。
- `r` は重みであり、省略時は $1$ である。
- $r=0$ の場合、バケットサイズ $B$ は $1$ であり、既定のバケットサイズを計算しない。
- $r\ne 0$ の場合、バケットサイズ $B$ は、 $M$ が正であれば $B^2\le M$ を満たす最大の $2$ の冪が選ばれる。 $M=0$ の場合は $B=1$ である
- $r\ne 0$ の場合、バケットサイズ $B$ は、 $B^2>M$ を満たす最小の $2$ の冪が選ばれる。
- 前提: $M\ge 0$ 。
- 前提: `T` は素数 $p$ を法とする体の型であり、整数からの構築、四則演算、等値比較を持つ。
- 前提: `std::numeric_limits<T>::is_integer` は `false` である。
Expand Down
2 changes: 1 addition & 1 deletion math/combinatorics/online-binomial-sum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ template <class T> struct OnlineBinomialSum {
assert(max_m >= 0);

int bucket_size = 1;
while (4LL * bucket_size * bucket_size <= max_m) {
while (static_cast<long long>(bucket_size) * bucket_size <= max_m) {
bucket_size *= 2;
}

Expand Down
Loading