@duxassassin sorry to disappoint you, i knew this formula long time ago, but i didn't know how to express decimal log with ln until 2 months ago... then i decided to upload it :)
i have to say that i hate tasks like this one ... so there aren't any idea to solve it ... it's just question: do you know formula ? ... and that is stupid for me, but that is just my opinion ...
You want to solve the following inequality: 10^{k} \le a^b < 10^{k+1}
The easy way to understand this is to look at the equality
\ln(x^y) = y \ln(x)
Now back to the original inequality. Since logarithm is a monotonic function, always increases. And since a^b is always bigger than zero, we can write:
\ln(10^{k})} \le \ln(a^b) < \ln(10^{k+1}) k \ln(10)} \le b \ln(a) < (k+1) \ln(10)
So we get that
k \le \frac {b \ln(a)}{\ln(10)} < (k+1)
So we get that
k = \bigg \lfloor \frac {b \ln(a)}{\ln(10)} \bigg \rfloor
ok, i understand ... or easier to explain ... a = 10^log10(a) so a^b = (10^log10(a))^b = 10^(log10(a)*b) so it's int(log10(a)*b)+1 ... and if you know log10 N = log2(N)/log2(10) ...
do you know to solve that task if you don't use that formula ??? you said: "Anyway, there are different ways to solve this problem, so its not that bad for algorithm problem as well."