Python 如何避免排列数计算中的冗余步骤?
我怎样才能使下面的脚本更智能,就像人类一样 (避免全因子的冗余计算) (我收到错误:值太大。)您可以使用此选项。将Python 如何避免排列数计算中的冗余步骤?,python,algorithm,function,math,permutation,Python,Algorithm,Function,Math,Permutation,我怎样才能使下面的脚本更智能,就像人类一样 (避免全因子的冗余计算) (我收到错误:值太大。)您可以使用此选项。将exact切换到True会以牺牲速度为代价给出整数形式的精确答案 >>> from scipy.special import comb >>> comb(10, 5, exact=False, repetition=False) 252.0 >>> comb(10, 5, exact=True, repetition=False)
exact
切换到True
会以牺牲速度为代价给出整数形式的精确答案
>>> from scipy.special import comb
>>> comb(10, 5, exact=False, repetition=False)
252.0
>>> comb(10, 5, exact=True, repetition=False)
252
请将代码粘贴为代码,而不是图像。
>>> from scipy.special import comb
>>> comb(10, 5, exact=False, repetition=False)
252.0
>>> comb(10, 5, exact=True, repetition=False)
252