跳到主要内容
← 返回题库
免费概率简单

Ship Destroyer

考察公司Citadel

题目

A 4×44 \times 4 grid has a ship in each of its 1616 cells. Four bombs fall, each landing in a cell chosen independently and uniformly at random (two bombs may hit the same cell). A bomb destroys every ship in its row and every ship in its column. What is the probability that all 1616 ships are destroyed?

解析

先自己试一试,卡住了再打开提示。

提示 1

A ship survives only if no bomb lands in its row and no bomb lands in its column. When can that happen?

提示 2

Every ship is destroyed exactly when the four bombs hit all four rows, or all four columns. Count each case and use inclusion–exclusion.

查看解析

When does a ship survive? The ship in row ii, column jj survives only if no bomb lands in row ii and no bomb lands in column jj. So some ship survives exactly when there is an empty row and an empty column.

Turning that around, every ship is destroyed exactly when

  • RR: the bombs hit all four rows, or
  • CC: the bombs hit all four columns.

With only four bombs, "hit all four rows" means the bombs land in four different rows.

Count the outcomes. Treat the bombs as ordered; there are 164=65,53616^4 = 65{,}536 equally likely outcomes.

  • ∣R∣|R|: give the four bombs four different rows (4!=244! = 24 ways), then any column each (44=2564^4 = 256 ways): 24⋅256=6,14424 \cdot 256 = 6{,}144.
  • ∣C∣|C|: the same count with rows and columns swapped: 6,1446{,}144.
  • ∣R∩C∣|R \cap C|: four different rows and four different columns: 4!⋅4!=5764! \cdot 4! = 576.

By inclusion–exclusion,

∣R∪C∣=6,144+6,144−576=11,712.|R \cup C| = 6{,}144 + 6{,}144 - 576 = 11{,}712.

Probability.

P=11,71265,536=1831024≈0.17871.P = \frac{11{,}712}{65{,}536} = \frac{183}{1024} \approx 0.17871.

Answer: 0.178710.17871.