lg(C) = B*lg(A), lg - decimal logarithm lg(x) = ln(X)/ln(10).
First three digits of C are first three digits of mantissa of lg(C).

That's how I got AC (not sure about mathematical correctness).

kp: I really don't understand,why first three digits of C are first three digits of mantissa of lg(C)?? For example,
lg(123456)= 5.091512... where is 123 ???
or can someone else explain it to me ??

I also calculated the first three digits using <math.h> and got accepted, but I still have some doubts about precision.
How can we be sure that a 100-million digit number that starts off "123999999999999999999999999..." is not printed as "124..." without doing bigint calculus?

I did the first three with fast exponentiation, I just kept moving the decimal point so it wouldn't go into infinity. Never occured to me that I could've used logs

little joey wrote:I also calculated the first three digits using <math.h> and got accepted, but I still have some doubts about precision.
How can we be sure that a 100-million digit number that starts off "123999999999999999999999999..." is not printed as "124..." without doing bigint calculus?

I think the 4th to 15th digit can be considered as some sort of pseudo-random number, then the probability that all these digits being 9 is exponentially small.