The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 406 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Problem description:
Â
Faizaan and Sejal were playing Mathematics games. Faizaan gave Sejal three numbers: N, M and K. Sejal has to find out a number X such that
Â
X = (N^M)%K
Â
Sejal initially thought that the problem was very easy, but she soon realised that N and M were very huge numbers. Help Sejal find out X.
Â
Note: A^B represents the value A raised to the power B.
Â
Input:
Â
First line contains a single integer 'T', denoting the number of test cases.
Â
There are three lines of input for every test case.
First line contains single integer N
Second line contains single integer M
Third line contains single integer K
Output:
Â
Answer for all 'T' test cases in 'T' lines.
Constraints:
1
1
1
1
Sample Input:
1
3
4
5
Sample Output:
1
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll