请帮助:子集总和 [英] Please Help : Subset Sum

查看:93
本文介绍了请帮助:子集总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编写一个从命令行获取数字列表的程序。第一个数字是目标值,数字的提醒(无论可能有多少)是您必须选择的数字集。该程序应输出其总和等于目标的子集或无组合匹配的子集。如果不存在这样的子集。



任何帮助都将不胜感激。

Im trying to write a program that takes a list of numbers from the command line. The first number is the target value and the reminder of the numbers (however many there may be) is the set of numbers you have to pick from. The program should either output a subset whose sum equals the target or "No combination matches" if no such subset exists.

Any help would be greatly appreciated.

推荐答案

看看< a href =http://stackoverflow.com/questions/4632322/finding-all-possible-combinations-of-numbers-to-reach-a-given-sum>查找所有可能的数字组合-to-a-given-sum [ ^ ] ..我认为这是你需要开始的。
have look at finding-all-possible-combinations-of-numbers-to-reach-a-given-sum[^]..I think this is what you need to start with.


这篇关于请帮助:子集总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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