MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / nCr

Function nCr

Python/CP_Templates.py:111–117  ·  view source on GitHub ↗
(n, r, MOD)

Source from the content-addressed store, hash-verified

109 return res
110
111def nCr(n, r, MOD):
112 global fac_warm_up, factorial_modP
113 if not fac_warm_up:
114 warm_up_fac(MOD)
115 fac_warm_up = True
116 return (factorial_modP[n] * (
117 (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD)) % MOD)) % MOD
118
119
120def test_print(*args):

Callers

nothing calls this directly

Calls 1

warm_up_facFunction · 0.85

Tested by

no test coverage detected