i have written the code for this problem but it is not passing all the test cases . what is wrong in the code ?
Modular exponentiation problem
Your logic is incorrect ,please read about modular exponentiation from here
but why the logic is incorrect ?
i have taken power of a^b, then took their modulus with 3rd no .
is that not the question ? please tell that .
You need to handle the overflow so you cannot simply do a^b
it is not passing one test case. please check.
okay it worked . but why you have used signed main here . what change does it make to the output ?
I used #define int long long at the top , so now every variable in your code is long long and hence prevents overflow
please clear this query also .
Now main could not return int because it does not name a type so I simply change it to sign to avoid this error, it doesn’t make a difference
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.