We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6376bf4 commit 25a07beCopy full SHA for 25a07be
math/ncr_modulo_p.cpp
@@ -40,7 +40,7 @@ class NCRModuloP {
40
*/
41
NCRModuloP(const uint64_t& size, const uint64_t& mod) {
42
p = mod;
43
- fac = std::vector<uint64_t>(size);
+ fac = std::vector<uint64_t>(size + 1);
44
fac[0] = 1;
45
for (int i = 1; i <= size; i++) {
46
fac[i] = (fac[i - 1] * i) % p;
0 commit comments