eolymp
bolt
Try our new interface for solving problems
Problems

Discrete logarithm

Discrete logarithm

Given positive integers \textbf{b}, \textbf{a_1}, \textbf{a_2}, ..., \textbf{a_N}. Required to calculate the value of \textbf{ floor(log_ba_1)}, …, \textbf{floor(log_ba_N)} where, \textbf{floor(x)} --- the largest integer not exceeding \textbf{x}. \InputFile The input file contains the number \textbf{N b a_1 a_2 ... a_N }one number per line. \OutputFile The output file should contain \textbf{N} integers - the result of calculation. \textbf{1} ≤ \textbf{N} ≤ \textbf{1000}, \textbf{2} ≤ \textbf{b} ≤ \textbf{100}, \textbf{1} ≤ \textbf{a_i} < \textbf{10^1000} (ie the number contain up to \textbf{1000} digits).
Time limit 3 seconds
Memory limit 64 MiB
Input example #1
1
2
63
Output example #1
5