Skip to content

Commit 25a07be

Browse files
committed
fix: set proper size of fac
1 parent 6376bf4 commit 25a07be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

math/ncr_modulo_p.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class NCRModuloP {
4040
*/
4141
NCRModuloP(const uint64_t& size, const uint64_t& mod) {
4242
p = mod;
43-
fac = std::vector<uint64_t>(size);
43+
fac = std::vector<uint64_t>(size + 1);
4444
fac[0] = 1;
4545
for (int i = 1; i <= size; i++) {
4646
fac[i] = (fac[i - 1] * i) % p;

0 commit comments

Comments
 (0)