Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The answer has nothing to do with perl, only with math.
First you have to tell us if the containers have a maximal capacity; from your examples I'd guess so. If that's the case, the number of combinations is the factorial of the total capacity of all containers, divided by the product of the factorials of each capacity. So in your example 6! ----------- 2! * 2! * 2! This assumes that order insider containers doesn't matter, ie that 12 34 5 is the same as 21 34 5, but that the order of containers does matter. (If it doesn't, you need to divide by the factorial of number containers). If that's not what you want, you have to provide a few more details.
Perl 6 - links to (nearly) everything that is Perl 6.
In reply to Re: x objects in y containers where all objects are used
by moritz
|
|