Pagini recente » Cod sursa (job #1932464) | Cod sursa (job #1230695) | Cod sursa (job #2989347) | Cod sursa (job #1454173) | Cod sursa (job #1672751)
import java.io.*;
import java.util.*;
class Main {
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();
}
}