幸运糖果
Lucky Candy
题目详情
你有 50 颗好糖和 50 颗坏糖,要放进两个盒子。
规则:先等概率随机选一个盒子,再从该盒子里等概率随机取出一颗糖。
如何摆放,才能让取到好糖的概率最大?
提示:把所有好糖放一个盒子、所有坏糖放另一个盒子得到的概率是 0.5,但这不是最优。
How do you place 50 good candies and 50 rotten candies in two boxes such that if you choose a box at random and take out a candy at random, it better be good!
We need to maximize the probability of getting a good candy when selecting a random box and a random candy from it.
Hint
Placing all bad in 1 box and all good in another will give the probability of 0.5, which is not the maximum.
解析
最优做法:
- 盒子 A:放 1 颗好糖。
- 盒子 B:放剩下的 49 颗好糖 + 50 颗坏糖。
此时取到好糖概率为:
直觉:让一半概率的“选中盒子 A”直接确保成功,同时另一半概率中尽量不把好糖比例降得太厉害。
Original Explanation
Place 1 good candy in one box and all the remaining (49 good and 50 rotten candies) in the second box.
Solution
Place 1 good candy in one box and all remaining (49 good and 50 rotten candies) in the second box.
This will give a probability of