2589 -
Twenty Questions North America - North Central - 2002/2003 | |||||
In the game of ``twenty questions" I think of an item (like a fish) from a
set of N With just 20 questions you could identify any one of 524,288 items, assuming
you can distinguish among them by asking 19 ``yes/no" questions and then with
your 20th Suppose you could ask questions that could be answered with more than just a
``yes" or ``no". For example, suppose you could ask, ``Does it weight less than,
equal to, or greater than 10 pounds?" This question has three possible answers.
Then how many questions would you need to ask in order to distinguish among
N In this problem you will be told how many different answers can be given to
each of your questions, and the number of items in the set of possible choices
for the item. All you need to do is determine the maximum number of questions
that must be asked to identify the item. This assumes that your questions are
chosen in such a way as to divide the remaining candidates for the item into
suitably sized groups.
There will be multiple cases to consider. For each case there will be two
integers in the input. The first integer, K
For each input case, display a single line that looks like this:
Input
Output
N
where N Sample
Input
2 524288
3 524288
4 524288
3 9
10 1000
0 0
Sample
Output
524288 items, 2 answers per question, 20 questions
524288 items, 3 answers per question, 13 questions
524288 items, 4 answers per question, 11 questions
9 items, 3 answers per question, 3 questions
1000 items, 10 answers per question, 4 questions
North Central 2002-2003