I can’t seem to find out why my answer is wrong, can someone give me a sample input for which my program prints an incorrect answer, please? Here’s the link to my solution.
http://www.codechef.com/viewsolution/4118121
your power function has no modding and is the reason you are getting wrong ans.
For large value of n you will exceed long long limit and get wrong values.
So that’s why it worked with my inputs but failed when I submitted it. Thank you!
I made changes to the original code using mod, but I am still getting WA result when I submit my solution. (It still works with smaller values though.)
Here’s a link to my solution:
http://www.codechef.com/viewsolution/4120414