5 袋硬币(9/10/11g)一次称重判定
Counterfeit Coins II
题目详情
有 5 袋硬币,每袋 100 枚。每袋硬币重量一致,但可能是 9g、10g 或 11g。
你不知道每袋是哪种。
你有电子秤。
问:最少称几次可以确定每袋硬币的重量类型?
There are 5 bags, each containing 100 coins. A coin can weigh 9 g, 10 g, or 11 g. Each bag has coins all of the same weight, but you do not know which. You have a digital scale. How many weighings do you need to determine the weight type of each bag?
解析
一次称重即可。
把 5 袋编号 1~5,分别取 枚硬币一起称重。
若都为 10g,期望重量为 。
实际读数与 1210 的差值可看作“以 3 为底”的编码,解出每袋是偏轻(-1)、正常(0)还是偏重(+1),从而唯一确定 5 袋的重量类型。
Original Explanation
Just 1 weighing. Label bags 1 to 5, and take coins respectively (a base-3 style approach). Weigh them all together once. The difference from the “normal” total (if all were 10 g) encodes which bags are 9 g or 11 g. Essentially, each bag’s choice (9,10,11) contributes a digit in base 3, letting you solve for each bag’s coin weight.