http://www.codechef.com/viewplaintext/3493800 pls explain me the code…y he taking 1000000006 for processing the second string???..thanks
According to Fermat’s Little Theorm, A^ (p-1) ≡ 1 % p , where p is a prime number.
Hence we take B%(p-1) => B%(10^9+6).
Now we have two 9 digit numbers which we solve using fast exponentiation.
I want to know what exactly he is doing with two integers…can anyone explain it step by step??