![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
brian_d_foy,
You can look at this problem two different ways. The first way is a variation on the bin packing problem. There are many threads here as well as a number of modules on CPAN. There are heuristic approaches that are much faster than brute force but they don't guarantee no waste.
The second way, is restricted integer partitioning. See How to generate restricted partitions of an integer and puzzle: how many ways to make $100 for instance. This isn't exactly your problem because it assumes you have an unlimited number of each stamp denomination. On the other hand, it is interesting to learn about. And while we are at it, consider that unrestricted integer partions are also fun - see below for a list:
Cheers - L~R In reply to Re: How can I calculate the right combination of postage stamps?
by Limbic~Region
|
|