多类别组合数的快速计算
我必须评估以下重复对象排列的公式
n!/(r1! * r2! * r3! * ......... * rn!)
其中n <= 500
和 1 <= ri <= 10
(总共有 n 个对象,其中 r1 属于第 1 类,r2 属于第 2 类,所以上,公式表示此类对象的排列数量)。
为此,我需要一个有效的编码解决方案,因为在 Java 中处理大整数对于大型情况来说并没有什么成效。
提前致谢。
I have to evaluate the following formula for permutations with repeated objects
n!/(r1! * r2! * r3! * ......... * rn!)
wheren <= 500
and 1 <= ri <= 10
(there are n objects in total out of which r1 are alike of 1 kind , r2 are alike of 2nd kind and so on and the formula indicates the number of permutations of such objects).
I need an efficient coding solution for this because working with big integers in Java doesn't prove to be fruitful for large cases.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过使用
设计来实现您的问题,从而在java中完成此操作。
请参阅此链接以获取参考
或
如下所示:
来源
You can do this in java by using
designed to achieve a kind of your problem.
See this link for your reference
OR
like this :
source