|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|90 초||512 MB||2||1||1||50.000%|
Kelly is allergic to exactly one of N foods, but she isn't sure which one. So she decides to undergo some experiments to find out.
In each experiment, Kelly picks several foods and eats them all. She waits A days to see if she gets any allergic reactions. If she doesn't, she knows she isn't allergic to any of the foods she ate. If she does get a reaction, she has to wait for it to go away: this takes a total of B days (measured from the moment when she ate the foods).
To simplify her experimentation, Kelly decides to wait until each experiment is finished (after A or B days) before starting the next one. At the start of each experiment, she can choose the set of foods she wants to eat based on the results of previous experiments.
Kelly chooses what foods to eat for each experiment to minimize the worst-case number of days before she knows which of the N foods she is allergic to. How long does it take her in the worst case?
The first line of the input gives the number of test cases, T. T test cases follow. Each test case on a single line, containing three space-separated integers: N, A and B.
For each test case, output one line containing "Case #x: y", where x is the test case number (starting from 1) and y is the number of days it will take for Kelly to find out which food she is allergic to, in the worst case.
3 4 5 7 8 1 1 1 23 32
Case #1: 12 Case #2: 3 Case #3: 0
In the first sample case: