Math day hackerblocks

https://hack.codingblocks.com/app/contests/584/139/problem
check out this problem the binary expo. of (a,n!,p) does not work here properly for bigger n …

Hello @Ashu1318 we have to think some logic like here it is goven that n is large then it factorial would be even more larger and then its power evaluated will be more large so this we woud not be able to store in any data type.

okay then tell me how can we do it …

Hello @Ashu1318 have you seen the video for the same on your portal?

or do you know about the modular exponentiation in logn time you have to just use for loop with that.

Hello @Ashu1318 you can see this code:


if you have any doubt in this you can ask here:
Happy Learning!!

okay got my error thanks…