competitive-programming-library

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

View the Project on GitHub yu-0811/competitive-programming-library

:warning: algorithm_library/python/math/modComb.py

Code

# 組合せ総数ライブラリ
mod = 998244353

MAX = pow(10,6) # n の最大値
fact = [1, 1] 
factinv = [1, 1]  
inv = [0, 1] 
for i in range(2, MAX+1):
    fact.append((fact[i-1] * i) % mod)
    inv.append((mod-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[i-1] * inv[i]) % mod)
    
def modComb(n,k): # nCk % modを返す
  if (k < 0 or n<0) or (n < k):return 0
  if k==1: return n
  k = min(k,n-k)
  return fact[n]*factinv[k]%mod*factinv[n-k]%mod
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/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.11.0/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page