开发者

Backtracking recursion question

There is a bag that can take X kilogram. You will get an array of stuff and their weight. Print true and the each weight of the stuff and false if there is 开发者_开发百科no answer

Example:

for X=20
array {4,9,1,15,7,12,3}
print true and 4 1 15 (4+1+15=20)


This is a variation of subset sum problem.

You can find some guidelines of approaching this using backtracking here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜