计算值n选择k [英] Calculate value of n choose k
本文介绍了计算值n选择k的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是评价n个选择k值的最有效的方法? 在蛮力方式,我认为是找到N个因子/ K因子/(NK)的阶乘。
What is the most efficient method to evaluate the value of n choose k ? The brute force way I think would be to find n factorial / k factorial / (n-k) factorial .
有一个更好的策略可能是根据这个递推公式使用DP。是否有其他更好的方法来评估ñ选择k?
A better strategy may be to use dp according to this recursive formula. Is there any other better method to evaluate n choose k ?
推荐答案
您可以用乘法公式如下:
You could use the Multiplicative formula for this:
<一个href="http://en.wikipedia.org/wiki/Binomial_coefficient#Multiplicative_formula">http://en.wikipedia.org/wiki/Binomial_coefficient#Multiplicative_formula
这篇关于计算值n选择k的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文