in reply to Re^2: Golf: Grocery Bagging
in thread (Golf) Grocery Bagging
You can merely start adding stuff until an overflow occurs, switching to the next bag as necessary.
No, I thought that too, at first, but you've got the problem of having permitted
negative elements, so adding the next element might overflow, but the element
after that (if negative) might bring it back. Argh!
So while there might be a solution other than generating all possible partitions
and seeing which ones have acceptable weights, it's not along the line of "fill
until it won't fit". Sorry.
-- Randal L. Schwartz, Perl hacker