Submission #213565

#TimeUsernameProblemLanguageResultExecution timeMemory
213565berryzedGreat Pow! (kriii1_G)Java
0 / 1
104 ms11668 KiB
import java.util.Scanner; public class G { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long a = scanner.nextLong(); long k = scanner.nextLong(); System.out.println(pow(a, k) % (a + 1)); } private static long pow(long a, long k) { if (k < 0) { return a; } else { return pow(a * a, k-1); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...