返回题库

幽灵每晚挪到相邻房间:如何保证找到宝藏?

a ghost moves the treasure to an adjacent room

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

题目详情

有一排 10 个房间,其中一个房间里有宝藏。每天夜里幽灵会把宝藏移动到相邻的房间(只能移动 1 间)。

你每天只能检查 1 个房间。如何保证最终找到宝藏?

There is a row of 10 rooms and a treasure in one of them. Each night, a ghost moves the treasure to an adjacent room. You are trying to find the treasure, but can only check one room per day. How do you find it?

解析

用“从一端扫到另一端再扫回来”的固定策略即可保证抓到。

例如按如下顺序每天检查:

1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1,\ldots

直观理由:宝藏每天最多移动 1 格,而你在扫的过程中每天检查的位置也在单步移动。宝藏不可能“跳过”你正在推进的检查前沿;当你扫到端点并折返时,会把宝藏的可能位置区间持续压缩并最终在某一天与你检查的房间重合,因此必能找到。