返回题库

两红两绿两黄

How many weighings on a scale are necessary to identify the three heavy balls

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

题目详情

有两颗红球、两颗绿球、两颗黄球。每种颜色中一颗是重的、另一颗是轻的。

所有重球重量相同,所有轻球重量相同。

用天平最少称几次,才能确定三种颜色各自哪一颗是重球?

英文原题

We have two red, two green and two yellow balls. For each color, one ball is heavy and the other is light. All heavy balls weigh the same. All light balls weigh the same. How many weighings on a scale are necessary to identify the three heavy balls?

解析

每种颜色重球在两颗中二选一,共 23=82^3=8 种情况。一次称重只有 3 种结果,因此至少需要 log38=2\lceil\log_3 8\rceil=2 次称重。

下面给出一个用 2 次称重一定能确定的策略(可自适应):

把每种颜色两球分别记为 R1,R2R_1,R_2G1,G2G_1,G_2Y1,Y2Y_1,Y_2

第 1 次称重:称 R1+G1R_1+G_1(左)对 R2+Y1R_2+Y_1(右)。

记结果为:左重 / 平衡 / 右重。第二次称重按第 1 次结果选择:

  • 若第 1 次“左重”,则可能情况只有 3 种:

    1. R1,G1,Y1R_1,G_1,Y_1 为重;
    2. R1,G1,Y2R_1,G_1,Y_2 为重;
    3. R1,G2,Y2R_1,G_2,Y_2 为重。

    第 2 次称重:称 G1G_1(左)对 Y2Y_2(右)。

    • 左重:对应情况 1(G1G_1 重且 Y2Y_2 轻),重球为 R1,G1,Y1R_1,G_1,Y_1
    • 平衡:对应情况 2(G1G_1Y2Y_2 都重),重球为 R1,G1,Y2R_1,G_1,Y_2
    • 右重:对应情况 3(G1G_1 轻且 Y2Y_2 重),重球为 R1,G2,Y2R_1,G_2,Y_2
  • 若第 1 次“平衡”,则只可能是两种情况之一:

    1. R1,G2,Y1R_1,G_2,Y_1 为重;
    2. R2,G1,Y2R_2,G_1,Y_2 为重。

    第 2 次称重:称 R1R_1(左)对 R2R_2(右)。

    • 左重:重球为 R1,G2,Y1R_1,G_2,Y_1
    • 右重:重球为 R2,G1,Y2R_2,G_1,Y_2
  • 若第 1 次“右重”,则可能情况只有 3 种:

    1. R2,G1,Y1R_2,G_1,Y_1 为重;
    2. R2,G2,Y1R_2,G_2,Y_1 为重;
    3. R2,G2,Y2R_2,G_2,Y_2 为重。

    第 2 次称重:同样称 G1G_1(左)对 Y2Y_2(右)。

    • 左重:对应情况 1(G1G_1 重且 Y2Y_2 轻),重球为 R2,G1,Y1R_2,G_1,Y_1
    • 平衡:对应情况 2(G1G_1Y2Y_2 都轻),重球为 R2,G2,Y1R_2,G_2,Y_1
    • 右重:对应情况 3(G1G_1 轻且 Y2Y_2 重),重球为 R2,G2,Y2R_2,G_2,Y_2

因此 2 次称重既必要也足够。


英文解析

Each color has two heavy balls, with a total of 23=82^3=8 possible cases. Since a single weighing yields only 3 outcomes, at least log38=2\lceil\log_3 8\rceil=2 weighings are required.

Below is a strategy that guarantees identification of the heavy balls in 2 weighings (adaptive):

Label the two balls of each color as R1,R2R_1,R_2, G1,G2G_1,G_2, and Y1,Y2Y_1,Y_2.

1st Weighing: Weigh R1+G1R_1+G_1 (left) against R2+Y1R_2+Y_1 (right).

Record the result as: Left heavy / Balanced / Right heavy. The 2nd weighing is chosen based on the 1st result:

  • If the 1st result is "Left heavy", there are only 3 possible cases:

    1. R1,G1,Y1R_1,G_1,Y_1 are heavy;
    2. R1,G1,Y2R_1,G_1,Y_2 are heavy;
    3. R1,G2,Y2R_1,G_2,Y_2 are heavy.

    2nd Weighing: Weigh G1G_1 (left) against Y2Y_2 (right).

    • Left heavy: Corresponds to case 1 (G1G_1 heavy andY2Y_2 light); the heavy balls areR1,G1,Y1R_1,G_1,Y_1.
    • Balanced: Corresponds to case 2 (G1G_1 andY2Y_2 both heavy); the heavy balls areR1,G1,Y2R_1,G_1,Y_2.
    • Right heavy: Corresponds to case 3 (G1G_1 light andY2Y_2 heavy); the heavy balls areR1,G2,Y2R_1,G_2,Y_2.
  • If the 1st result is "Balanced", it must be one of two cases:

    1. R1,G2,Y1R_1,G_2,Y_1 are heavy;
    2. R2,G1,Y2R_2,G_1,Y_2 are heavy.

    2nd Weighing: Weigh R1R_1 (left) against R2R_2 (right).

    • Left heavy: The heavy balls are R1,G2,Y1R_1,G_2,Y_1.
    • Right heavy: The heavy balls are R2,G1,Y2R_2,G_1,Y_2.
  • If the 1st result is "Right heavy", there are only 3 possible cases:

    1. R2,G1,Y1R_2,G_1,Y_1 are heavy;
    2. R2,G2,Y1R_2,G_2,Y_1 are heavy;
    3. R2,G2,Y2R_2,G_2,Y_2 are heavy.

    2nd Weighing: Similarly, weigh G1G_1 (left) against Y2Y_2 (right).

    • Left heavy: Corresponds to case 1 (G1G_1 heavy andY2Y_2 light); the heavy balls areR2,G1,Y1R_2,G_1,Y_1.
    • Balanced: Corresponds to case 2 (G1G_1 andY2Y_2 both light); the heavy balls areR2,G2,Y1R_2,G_2,Y_1.
    • Right heavy: Corresponds to case 3 (G1G_1 light andY2Y_2 heavy); the heavy balls areR2,G2,Y2R_2,G_2,Y_2.

Thus, 2 weighings are both necessary and sufficient.