diff --git a/docs/math/combinatorics/online-binomial-sum.md b/docs/math/combinatorics/online-binomial-sum.md index a57cfa1..8c794b3 100644 --- a/docs/math/combinatorics/online-binomial-sum.md +++ b/docs/math/combinatorics/online-binomial-sum.md @@ -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$ の冪が選ばれる。 ## 使い方 @@ -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::is_integer` は `false` である。 diff --git a/math/combinatorics/online-binomial-sum.hpp b/math/combinatorics/online-binomial-sum.hpp index f111534..0792ea7 100644 --- a/math/combinatorics/online-binomial-sum.hpp +++ b/math/combinatorics/online-binomial-sum.hpp @@ -224,7 +224,7 @@ template struct OnlineBinomialSum { assert(max_m >= 0); int bucket_size = 1; - while (4LL * bucket_size * bucket_size <= max_m) { + while (static_cast(bucket_size) * bucket_size <= max_m) { bucket_size *= 2; }