1230 - MODEX

package uvaTry;

import java.math.BigInteger;
import java.util.Scanner;

class Main1230 {

public static void main(String[] args) {
// TODO Auto-generated method stub
int test,i;

Scanner sc=new Scanner(System.in);
BigInteger z,x,y,n;
while(sc.hasNext())
{
test=sc.nextInt();
if(test==0)
break;
for(i=0;i<test;i++)
{
x=sc.nextBigInteger();
y=sc.nextBigInteger();
n=sc.nextBigInteger();
z=x.modPow(y, n);

System.out.println(z);

}

}


}

}

SHARE

Amit Ghosh

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment