You are trying to guess my favorite number. I tell you it is from 1-100 somewhere and is an interger. You can guess anything you like and I will tell you whether my number is higher or lower then your guess. What is the smallest number of guesses you can make to make sure you will get my number, no matter what it is?
Assume that I don't lie to you about the greater or less than value.
(In reply to
Possible solution? by fwaff)
If you also get the "equal" choice, I only seem to get 6 choices each time. Just split the set each time. For example for 17:
50 Lower
25 Lower
12 Higher
18 Lower
15 Higher
16 Higher
Or for
50 Higher
75 Higher
87 Higher
93 Higher
97 Higher
99 Lower
After 0 guesses, 100 numbers remain
After 1 guess, 50 numbers remain (49 on the other side)
After 2 guesses, 25 numbers remain (24 on the other side)
After 3 guesses, 12 numbers remain (12 on each side plus one in the middle)
After 4 guesses, 6 numbers remain (5 on the other side)
After 5 guesses, 3 numbers remain (2 on the other side)
After 6 guesses, 1 number remains (1 on the other side, and the one you guessed)
"On the other side" means 1-49 if you guessed 50, because there are 49 numbers there.
|
Posted by Gamer
on 2003-06-16 05:57:42 |