返回题库

免费圣代

Free Sundae

专题
Probability / 概率
难度
L6

题目详情

你在一家冰淇淋店排队,这时经理宣布:她会把一份免费圣代送给队伍中第一个生日与之前某位已买过冰淇淋的人相同的顾客。假设你不知道其他任何人的生日,且所有生日在平年 365 天中均匀分布。为了使自己拿到免费圣代的概率最大,你应该站在队伍的第几位?

You are in line at an ice cream shop when the manager announces that she will give a free sundae to the first person in line whose birthday is the same as someone who has already bought an ice cream. Assuming that you do not know anyone else's birthday and that all birthdays are uniformly distributed across the 365 days in a normal year, what position in line will you choose to maximize your probability of receiving the free sundae?

解析

当你排在第 nn 位时,拿到圣代的概率 p(n)p(n) 为: p(n)=[1364365363365365(n2)365]n1365,0<n365.p(n) = \left[1 \cdot \frac{364}{365} \cdot \frac{363}{365} \cdots \frac{365-(n-2)}{365}\right] \cdot \frac{n-1}{365}, \quad 0 < n \le 365. 我们要找满足 p(n)>p(n+1)p(n) > p(n+1) 的最小 nn,也就是满足 p(n)p(n+1)>1\frac{p(n)}{p(n+1)} > 1 的最小 nn

现在,

p(n)p(n+1)=365366nn1n\frac{p(n)}{p(n+1)} = \frac{365}{366 - n} \cdot \frac{n - 1}{n}

因此不等式变为:

365n365>366nn2,n2n365>0365n - 365 > 366n - n^2, \quad\Longrightarrow\quad n^2 - n - 365 > 0

解这个二次方程:

n=1±1+43652=1±1461219.6115n = \frac{1 \pm \sqrt{1 + 4 \cdot 365}}{2} = \frac{1 \pm \sqrt{1461}}{2} \approx 19.6115

所以向上取整得到

n=20.n = 20.

因此,排在第 2020 位时,获赠免费圣代的概率最大。


Original Explanation

The probability, p(n)p(n), of getting a sundae when you are the nn-th person in line is:

p(n)=[1364365363365365(n2)365]n1365,0<n365.p(n) = \left[1 \cdot \frac{364}{365} \cdot \frac{363}{365} \cdots \frac{365-(n-2)}{365}\right] \cdot \frac{n-1}{365}, \quad 0 < n \le 365.

We seek the smallest nn such that p(n)>p(n+1)p(n) > p(n+1), or p(n)p(n+1)>1\frac{p(n)}{p(n+1)} > 1

Now,

p(n)p(n+1)=365366nn1n\frac{p(n)}{p(n+1)} = \frac{365}{366 - n} \cdot \frac{n - 1}{n}

Thus the inequality becomes:

365n365>366nn2,n2n365>0365n - 365 > 366n - n^2, \quad\Longrightarrow\quad n^2 - n - 365 > 0

Solving the quadratic:

n=1±1+43652=1±1461219.6115n = \frac{1 \pm \sqrt{1 + 4 \cdot 365}}{2} = \frac{1 \pm \sqrt{1461}}{2} \approx 19.6115

so taking the ceiling gives

n=20.n = 20.

Hence, the 2020-th position maximizes the chances.