Solution: The Five Brigands
Since there are so many different solutions, it is sensible to introduce the
additional restriction that every brigand had at least 8 doubloons. For lower
minimal values, we get serious memory problems. For a minimal amount of 9,
there are no solutions. For min=7, there already are 294, for min=6 802
solutions...
The code...
local
proc {Brigands X}
A B C D2 E3
in
X = [A B C D2 E3]
X ::: 8#160 Everybody has at least 8d.; nobody has more than 160
A + B + C + 2*D2 + 3*E3 =: 200
A * 12 + B * 3 + C + D2 + E3 =: 200
D2 :: 8#100
E3 :: 8#66
{FD.distribute split X}
end
in
{ExploreOne Brigands}
end
...and the search tree
so there are 45 solutions with the additional restriction.
Markus Löckelt