2021-05-21から1日間の記事一覧

Project Euler Problem 15

>>> from scipy.special import comb >>> comb(40, 20, exact=True)

Pythonで階乗、順列、組み合わせを求める

階乗 >>> import math >>> math.factorial(3) 6 >>> math.factorial(4) 24 >>> math.factorial(5) 120 順列の場合の数 >>> from scipy.special import perm >>> perm(4, 2, exact=True) 12 >>> perm(5, 2, exact=True) 20 順列の生成 >>> import itertools >…