結果

問題 No.403 2^2^2
ユーザー uafr_csuafr_cs
提出日時 2016-07-22 23:59:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 996 bytes
コンパイル時間 2,451 ms
コンパイル使用メモリ 83,848 KB
実行使用メモリ 42,680 KB
最終ジャッジ日時 2024-04-24 07:59:14
合計ジャッジ時間 6,739 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
42,512 KB
testcase_01 AC 129 ms
42,484 KB
testcase_02 AC 128 ms
42,648 KB
testcase_03 AC 119 ms
41,724 KB
testcase_04 AC 129 ms
42,272 KB
testcase_05 AC 121 ms
41,920 KB
testcase_06 AC 129 ms
42,644 KB
testcase_07 AC 129 ms
42,412 KB
testcase_08 AC 129 ms
42,236 KB
testcase_09 AC 117 ms
42,096 KB
testcase_10 AC 125 ms
42,104 KB
testcase_11 AC 129 ms
42,480 KB
testcase_12 AC 135 ms
42,092 KB
testcase_13 AC 132 ms
42,584 KB
testcase_14 AC 137 ms
42,380 KB
testcase_15 AC 134 ms
42,616 KB
testcase_16 AC 140 ms
42,584 KB
testcase_17 AC 123 ms
42,228 KB
testcase_18 AC 135 ms
42,324 KB
testcase_19 AC 140 ms
42,080 KB
testcase_20 AC 135 ms
42,348 KB
testcase_21 AC 132 ms
42,336 KB
testcase_22 AC 139 ms
42,284 KB
testcase_23 AC 119 ms
41,660 KB
testcase_24 AC 130 ms
42,432 KB
testcase_25 AC 130 ms
42,364 KB
testcase_26 AC 137 ms
42,680 KB
testcase_27 AC 135 ms
42,504 KB
testcase_28 AC 117 ms
42,060 KB
testcase_29 AC 130 ms
42,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
	public static final long MOD = 1000000007L;
	
	public static long mod_pow(long a, long p, long MOD){
		if(a % MOD == 0){
			return 0;
		}else if(p == 0){
			return 1;
		}else if(p == 1){
			return a % MOD;
		}else if(p % 2 != 0){
			return ((a % MOD) * mod_pow(a, p - 1, MOD)) % MOD;
		}else{
			final long ret = mod_pow(a, p / 2, MOD);
			
			return (ret * ret) % MOD;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final String[] inputs = sc.next().split("[^0-9]");
		
		
		final long A = Long.parseLong(inputs[0]);
		final long B = Long.parseLong(inputs[1]);
		final long C = Long.parseLong(inputs[2]);
		
		final long fst = mod_pow(mod_pow(A, B, MOD), C, MOD);
		final long snd = mod_pow(A, mod_pow(B, C, MOD - 1), MOD);
		System.out.println(fst + " " + snd);
		
	}

}
0