#B4182. Ocean Babies Reproduction
Ocean Babies Reproduction
Ocean Babies Reproduction
Jimmy has recently purchased a new type of pet called "Ocean Babies". Each Ocean Baby, once it drinks water, begins reproducing. Initially, Jimmy has n Ocean Babies. Every hour, each Ocean Baby produces k new Ocean Babies. Therefore, after t hours, the total number of Ocean Babies is given by the formula: \( T = n \times (k+1)^t \).
Given various target numbers m, your task is to determine the minimum number of hours t required so that the total Ocean Babies count is at least m (i.e., \( T \ge m \)).
inputFormat
The first line contains three space-separated integers: n, k, and q, where:
- n is the initial number of Ocean Babies.
- k is the number of new Ocean Babies each existing baby produces every hour.
- q is the number of queries.
Each of the next q lines contains a single integer m, representing the target number of Ocean Babies that Jimmy wants to reach.
outputFormat
For each query, output a single integer representing the minimum number of hours needed such that the total number of Ocean Babies is at least m.
sample
1 2 3
3
7
10
1
2
3
</p>