#P10320. Attack Power Enhancement
Attack Power Enhancement
Attack Power Enhancement
Joey possesses a special skill that enhances his attack power from \(x\) to \(x^2\). However, the skill is not perfect: except for the first use, before each subsequent usage the current attack power decays to half of its value. Formally, if the initial attack power is \(x\), then:
\(f(0) = x\),
\(f(1) = x^2\), and for \(k \ge 2\), \[ f(k) = \left(\frac{f(k-1)}{2}\right)^2. \]
Given two integers \(x\) and \(n\), where the target threshold is \(2^n\), determine the minimum number of times Joey must use his skill (possibly 0) so that \(f(k) \ge 2^n\). If it is impossible for Joey's attack power to ever reach the target regardless of how many times the skill is used, output inf
.
Note: The first use does not include any decay. For subsequent uses, the decay happens immediately before applying the enhancement.
inputFormat
The input consists of a single line containing two integers \(x\) and \(n\) separated by a space.
- \(x\) represents the initial attack power.
- \(n\) is the exponent such that the target is \(2^n\).
outputFormat
Output a single line containing the minimum number of skill uses required so that the attack power \(f(k) \ge 2^n\). If no such \(k\) exists, output inf
(without quotes).
sample
6 5
1