Guess the number

Ana and Bernardo pass the time as follows: First, Ana choose a secret
number x between 1 and n. Afterwards, Bernardo conjectures which is that
x. If he guesses, the game ends. If he is wrong, Ana tells him if x is
greater or less than the number that Bernardo has conjectured. Bernardo
tries again, receiving the answer of Ana, as many times as it is
necessary until he guesses.

Your task is to write a program that, for each number n given, computes
the maximal number of conjectures that Bernardo must do to guess the
secret number, supposing that Bernardo plays the possible most cunning
way.

Input

The input consists of a sequence of numbers between one and one million.

Output

For each given number, your program must print a line with the maximal
number of conjectures that Bernardo must do to guess the secret number.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:24:00.672Z

© Jutge.org, 2006–2026.
https://jutge.org
