#P10320. 勇气(Courage)

勇气(Courage)

Background

Mathematicians’ virtue of seeking the beauty of truth, the source of unceasing strength — courage.


Joy, “Light of Courage”, is the succeeding chief of the Dwarf族 (Duwofu, pinyin), and also a warrior who possesses the power of the ancient God of War.

Problem Description

Joy has a skill that can strengthen an attack power of xx into x2x^2. However, this skill is not perfect: except for the first time, before each use of the skill, the attack power will decay to half of the previous value.

For example, if the initial attack power is 6\color{red}6, after strengthening it becomes 62=366^2=\color{red}{36}. Before the next strengthening, it will first decay to 36/2=1836/2=18, and then be strengthened into 182=32418^2=\color{red}{324}.

Joy wants to know: if the initial attack power is xx, what is the minimum number of strengthenings needed to make it not less than 2n2^n?
If no matter how many times it is strengthened, it is still impossible to meet the requirement, output inf.

Input Format

One line containing two positive integers x,nx,n, representing the initial attack power xx and the target attack power 2n2^n.

Output Format

Output one line with one integer or the string inf, representing the answer.

2 1
0
3 6
3
16 335
7

Hint

[Sample 11 Explanation]
The initial attack power x=2x=2 already reaches 2n=22^n=2, so it satisfies the requirement without using the skill. Therefore the answer is 00.

[Sample 22 Explanation]
The initial attack power is 33, and the target is 26=642^6=64. After the first use it becomes 99, after the second it becomes (9/2)2=81/4(9/2)^2=81/4, and after the third it becomes ((81/4)/2)2=6561/64((81/4)/2)^2=6561/64, which already meets the requirement. Therefore the answer is 33.

[Constraints]
This problem uses bundled testdata.

Subtask 1 (15 pts): n60n\le 60.
Subtask 2 (20 pts): x=4x=4.
Subtask 3 (25 pts): n105n\le 10^5.
Subtask 4 (40 pts): no special constraints.

For all testdata: 2x1092\le x\le 10^9, 1n1091\le n \le 10^9.

Translated by ChatGPT 5