检查给定总和的所有数字组合 [英] Check all combinations of numbers for a given sum

查看:96
本文介绍了检查给定总和的所有数字组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Basic中,我们收到了一些非常有趣的问题论坛,关于如何检查列表中所有可能的数字组合,以查找总和与给定数字匹配的数字。 (如果我正确地解释它的话。)


任何数学家都要关注一下吗?


如果我们可以想出一个算法我希望将它翻译成VB就足够了。

We have received what looks to me like quite an interesting question in the Visual Basic forum concerning how to check all possible combinations of numbers in a list for those where the sum matches a given number. (That''s if I''m explaining it correctly.)

Any mathematicians care to have a look?

If we can come up with an algorithm I expect translating it to VB will be easy enough.

推荐答案

好的我会咬人;只需要一点复苏就能做到;这是一个解决方案:

Ok I''ll bite; just a bit of resursion will do; here''s a solution:

展开 | 选择 | Wrap | 行号


可爱的整数分区。



可爱的整数分区。
Cute integer partitioning that.



是的,但我觉得答案并不像问题那样有趣;没有回复

也没有基本机器人的任何利益;哦...... ;-)

亲切的问候,


Jos

Yep, but I guess the answer isn''t as interesting as the question was; no replies
nor any interest from the Basic droids; oh well ... ;-)

kind regards,

Jos


这篇关于检查给定总和的所有数字组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆