Thanks @l_returns
Thanks for the test cases.
The links to the solutions are a bit mixed up. Currently, the solution marked as author solution is actually using int128.
long long d = (bpow(a, n, a - b) + bpow(b, n, a - b)) % (a - b)
Here why are we taking mod with (a-b) instead of 1e9+7 because a-b can be as big as 1e12 which is causing overflow but 1e9+7 won’t cause overflow. I am not able to understand where I am wrong.
my code is showing wrong answer even for the task 2 of sub-task 1.
plz. someone look into my code.
https://www.codechef.com/viewsolution/33210075
Can you please tell me what am I doing wrong in this code?
I cant pass the last 2 subtasks .Have been trying for quite a long time now .
Here is my submission :-CodeChef: Practical coding for everyone
Help would be appreciated
Your code fails in these testcases
4
21 264 2
21 264 3
21 264 4
21 264 5
Expected O/P :
9
27
81
243
Your O/P :
1
1
1
1