Can’t we use the fact that sum of digit repeats after every 6th power ??
Link : https://www.quora.com/How-do-I-find-sum-of-digits-of-a-large-no-raised-to-a-large-power
Doing so Gives WA.
Link to solution : https://www.codechef.com/viewsolution/16739992
Updated Link and added comments to code .
i have done that https://www.codechef.com/viewsolution/16717619 i am unable to understand you code
Edited link and added comments.
I have matched test cases with your solution and others solution as well.
Still not able to find out test case at which my code fails.
This is your AC code: https://www.codechef.com/viewsolution/16745930
The special case(3,6) is not for c but for SOD©
I have already solved it!!
Anyway thanks for the effort!!