sum it up !

时间:2016-09-05 08:44:14
【文件属性】:

文件名称:sum it up !

文件大小:3KB

文件格式:TXT

更新时间:2016-09-05 08:44:14

sum it up

Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t=4, n=6, and the list is [4,3,2,2,1,1], then there are four different sums that equal 4: 4,3+1,2+2, and 2+1+1.(A number can be used within a sum as many times as it appears in the list, and a single number counts as a sum.) Your job is to solve this problem in general.


网友评论