作者nonagoner (哈)
看板Grad-ProbAsk
標題[理工] [資結]-交大97
時間Sun Feb 21 16:44:55 2010
Given a set of integers X={x1,x2,...,xn} and an integer bound B, design an
algorithm that determines whether a subset X' of X exists such that all
element of X' sum to exactly B.
本來想寫成從大的整數開始取至小的不大於B的總和看是否存在子集,但是好像會忽略一
些排列順序,請問這題要怎麼取出正確子集呢?感謝高手解答
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.142.132
推 FRAXIS:搜尋subset-sum problem 他是NP-Complete問題 02/21 18:04
→ nonagoner:謝謝樓上 02/21 18:20