WA in ABX01 Lunchtime

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 : CodeChef: Practical coding for everyone

Updated Link and added comments to code .

i have done that CodeChef: Practical coding for everyone i am unable to understand you code

This is your AC code: CodeChef: Practical coding for everyone

Mistake:

The special case(3,6) is not for c but for SOD(c)

1 Like

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.

I have already solved it!!

Anyway thanks for the effort!!