返回题库

猫狗排队:求狗的比例

Cat Dog Line

专题
Brainteaser / 脑筋急转弯
难度
L4

题目详情

在一条无限长的人行道上,动物排成一列。

你观察到:

  • 每 7 只猫里有 6 只后面紧跟一只狗;
  • 每 4 只狗里有 1 只后面紧跟一只猫。

问:人行道上动物中狗所占比例是多少?

You're walking down an infinite street, and you notice that six out of every seven cats on a sidewalk are followed by a dog, while one out of every four dogs is followed by a cat. What proportion of animals on the sidewalk are dogs?

解析

设猫与狗的比例分别为 c,dc,dc+d=1c+d=1

由“猫后面跟狗”的结构,可得狗的比例满足

d=67c(1+34+(34)2+)=67c113/4=247c.d=\frac{6}{7}c\left(1+\frac{3}{4}+\left(\frac{3}{4}\right)^2+\cdots\right)=\frac{6}{7}c\cdot\frac{1}{1-3/4}=\frac{24}{7}c.

代入 c+d=1c+d=1c=731c=\frac{7}{31},所以

d=2431.d=\frac{24}{31}.

Original Explanation

Let cc and dd, respectively, be the proportion of cats and dogs on the sidewalk. We know c+d=1c + d = 1. Let's find dd in terms of cc. Note that of all the cats, 67\frac{6}{7} are followed by a dog. Then, of those dogs, 34\frac{3}{4} of them are followed by another dog. Of those dogs, 34\frac{3}{4} are followed by another dog, etc. Therefore, we can write

d=67c+6734c+67(34)2c+=6c7k=0(34)k=24c7d = \frac{6}{7}c + \frac{6}{7} \cdot \frac{3}{4}c + \frac{6}{7} \cdot \left(\frac{3}{4}\right)^2 c + \dots = \frac{6c}{7} \sum_{k=0}^{\infty} \left(\frac{3}{4}\right)^k = \frac{24c}{7}

Substituting this into our initial equation,

31c7=1\frac{31c}{7} = 1

so

c=731c = \frac{7}{31}

This means

d=2431d = \frac{24}{31}

Alternatively, you can create a Markov chain representing this scenario. Namely, if state 11 is dog and state 22 is cat, the Markov chain is

[3/41/46/71/7]\begin{bmatrix} 3/4 & 1/4 \\ 6/7 & 1/7 \end{bmatrix}

The steady state of this Markov chain yields the same answer as above.