飞鱼问题的答案全解

来源: 2014-03-06 12:31:21 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

Identical toys to five dogs.

Five situations

1. pick only one dog to have all 5 toys: C(5,1) = 5
2. pick two dogs to distribute 5 toys: C(5,2)*(C(2,1) + C(2,1)) = 40
3. Pick three dogs to distribute 5 toys: C(5,3) * (C(3,1) + C(3, 2)) = 60
4. Pick four dogs to distrubte 5 toys: C(5,4) * C(4,1) = 20
5. Pick five dogs to distribute 5 toys: C(5, 5) = 1

total = 126

Non-identical toys to five dogs

When toys are non-identical, it is simular. We just need to add permutation to the above situations: P(5,5). in the mean time, we need to
 exclude permutation from one dog having multiple toys and permuation of toys on the same dog needs to be excluded.

Five situations:

1. pick only one dog to have all 5 toys: C(5,1) * P(5,5) / P(5,5) = 5
2. pick two dogs to distribute 5 toys: C(5,2)*(C(2,1) * P(5,5) / P(4,4) + C(2,1) * P(5,5)/(P(3,3)*P(2,2)) = 300
3. Pick three dogs to distribute 5 toys: C(5,3) * (C(3,1) * P(5,5)/P(3,3) + C(3, 2) * P(5,5) / (P(2,2)*P(2,2)) = 1500
4. Pick four dogs to distrubte 5 toys: C(5,4) * C(4,1) * P(5,5) / P(2,2) = 1200
5. Pick five dogs to distribute 5 toys: C(5, 5) * P(5,5) = 120

Total = 3125

It is the identical logic to go from identical toys to non-identical toys. The only thing that is needed is to add the permutatin carefully
to the equation and exclude the wrong permutation.