0%

Problem 887


Problem 887


Consider the problem of determining a secret number from a set {1,,N} by repeatedly choosing a number y and asking “Is the secret number greater than y?”.

If N=1 then no questions need to be asked. If N=2 then only one question needs to be asked. If N=64 then six questions need to be asked. However, in the latter case if the secret number is 1 then six questions still need to be asked. We want to restrict the number of questions asked for small values.

Let Q(N,d) be the least number of questions needed for a strategy that can find any secret number from the set {1,,N} where no more than x+d questions are needed to find the secret value x.

It can be proved that Q(N,0)=N1. You are also given Q(7,1)=3 and Q(777,2)=10.

Find d=07N=1710Q(N,d).


有界二分搜索

考虑如下问题:现需从集合{1,,N}中确定一个秘密数值,每次可以选择一个数y,并询问“秘密数值是否大于y?”。

如果N=1,则无需提问。如果N=2,则只需要问一个问题。如果N=64,则需要问六个问题,但采取这种策略时,即使秘密数值是1,也仍然需要问六个问题。相反,本题希望寻找一种尽可能减少秘密数值较小时所需提问数量的策略。

考虑所有从集合{1,,N}中找出任意秘密数值x所需的问题数不超过x+d的策略,记这种策略所需的最少提问次数为Q(N,d)

可以证明Q(N,0)=N1。已知Q(7,1)=3Q(777,2)=10

d=07N=1710Q(N,d)


Gitalking ...