def binom(n: int, k: int) -> int:
'''Computes the binomial coefficient.
This shows how many combinations of
*n* things taken in groups of size *k*.
:param n: size of the universe
:param k: size of each subset
:returns: the number of combinations
>>> binom(52, 5)
2598960
>>> binom(52, 0)
1
>>> binom(52, 52)
1
'''
return factorial(n) // (factorial(k) * factorial(n-k))
ch11_r01.py 文件源码
python
阅读 45
收藏 0
点赞 0
评论 0
评论列表
文章目录