Pagini recente » Cod sursa (job #976960) | Cod sursa (job #994718) | Cod sursa (job #2677570) | Cod sursa (job #3122918) | Cod sursa (job #1672756)
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
class Main{
public static long MOD = 1999999973;
public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
Scanner scanner = new Scanner(new FileInputStream("lgput.in"));
long base = scanner.nextLong();
long exponent = scanner.nextLong();
long modulo = 1999999973;//scanner.nextLong();
long result = 1;
while (exponent > 0) {
if (exponent % 2 == 1) {
result = (result * base) % modulo;
}
base = (base * base) % modulo;
exponent = exponent / 2;
}
PrintWriter writer = new PrintWriter("lgput.out", "UTF-8");
writer.println(result);
writer.close();
}
static long solve( long a, long p ){
if ( p == 0 ){
return 1;
}
if ( p == 1 ){
return a;
}
if ( p%2==0 ){
long aux = solve( a, p/2 );
return ( aux * aux ) % MOD;
} else {
return ( a * solve( a, p-1 ) ) % MOD ;
}
}
}