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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Golf: Grocery Bagging
by tadman (Prior) on May 23, 2001 at 20:27 UTC | |
by MeowChow (Vicar) on May 23, 2001 at 21:37 UTC |
In Section
Meditations