← All problemsSign in

Akki finds the remainder

Professor Shekhu has another problem for Akki today. He has given him $3$ positive integers $A, N, P$ and wants him to calculate the remainder when AN! is divided by $P$. As usual, $N!$ denotes the product of the first $N$ positive integers. ###Input: - The first line of the input gives the number of test cases, $T$. $T$ lines follow. - Each line contains three integers $A, N, P$ as described abo

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start