AtCoder-Library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub ryusuke920/AtCoder-Library

:warning: Math/Combination.py

Code

class Combination:
    def __init__(self, N: int, MOD: int) -> None:
        self.N = N + 100
        self.MOD = MOD
        self.fac = [0]*(self.N + 1)
        self.fac_inv = [0]*(self.N + 1)
        self.fac[0] = 1
        self.fac_inv[0] = 1

        for i in range(1, self.N + 1):
            self.fac[i] = self.fac[i - 1] * i
            self.fac[i] %= self.MOD
        
        for i in range(1, self.N + 1):
            self.fac_inv[i] = pow(self.fac[i], self.MOD - 2, self.MOD)
    
    def nCr(self, N: int, R: int) -> int:
        return self.fac[N]*self.fac_inv[R]*self.fac_inv[N - R] % self.MOD

    def nPr(self, N: int, R: int) -> int:
        return self.nCr(N, R)*self.fac[R] % self.MOD


def main() -> None:
    N = 10**5
    mod = 998244353
    Com = Combination(N, mod)


if __name__ == "__main__":
    main()
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page