xinyu04

导航

MathProblem 20 Nine minute egg problem

You are a cook in a remote area with no clocks or other way of keeping time other than a 4 minute hourglass and a 7 minute hourglass. You do have a stove however with water in a pot already boiling. Somebody asks you for a 9 minute egg, and you know this person is a perfectionist and will be able to tell if you undercook or overcook the eggs by even a few seconds. What is the least amount of time it will take to prepare the egg?

Solution

需要利用 \(4\) min, \(7\) min 产生 \(9\) min.
思路:

  • 同使启动 \(4min, 7min\) 的沙漏,在 \(4min\) 结束的时候翻转,此时另一个沙漏还剩 \(3min\),此时总共耗时 \(4min\).
  • \(7min\) 的沙漏用完时进行翻转,此时 \(4min\) 沙漏还剩 \(4-3=1min\),总共耗时 \(7min\).
  • \(4min\) 的沙漏用完,\(7min\) 的沙漏也走了 \(1min\), 此时耗时 \(7+1=8min\)
  • 再将 \(7min\) 的沙漏倒置,耗时 \(1min\),此时便得到 \(8+1=9\) min

posted on 2022-08-02 03:44  Blackzxy  阅读(15)  评论(0编辑  收藏  举报