good point! Converting my program to combinations is trivial. Make sure that children are added to any tree node only if their number is >= than current.
foreach(@$input){ # add this to make sure that we have combinations rather than permut +ations: next if( defined($v) && $_ < $v->{'number'} ); ...
for target 35 it yields:
tr_strictly_perms.pl : here are all the solutions: 1)5,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 2)7,2,2,2,2,2,2,2,2,2,2,2,2,2,2 3)5,5,5,2,2,2,2,2,2,2,2,2,2 4)7,5,5,2,2,2,2,2,2,2,2,2 5)7,7,5,2,2,2,2,2,2,2,2 6)7,7,7,2,2,2,2,2,2,2 7)5,5,5,5,5,2,2,2,2,2 8)7,5,5,5,5,2,2,2,2 9)7,7,5,5,5,2,2,2 10)7,7,7,5,5,2,2 11)7,7,7,7,5,2 12)5,5,5,5,5,5,5 13)7,7,7,7,7
In reply to Re^3: check possible combination of sum using given array
by bliako
in thread check possible combination of sum using given array
by dideod.yang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |