結果

問題 No.403 2^2^2
ユーザー uafr_csuafr_cs
提出日時 2016-07-22 23:34:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 953 bytes
コンパイル時間 2,285 ms
コンパイル使用メモリ 80,608 KB
実行使用メモリ 42,500 KB
最終ジャッジ日時 2024-04-24 02:42:39
合計ジャッジ時間 6,604 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
42,200 KB
testcase_01 AC 125 ms
42,020 KB
testcase_02 AC 135 ms
41,972 KB
testcase_03 AC 126 ms
42,404 KB
testcase_04 AC 126 ms
42,176 KB
testcase_05 AC 126 ms
42,260 KB
testcase_06 AC 118 ms
42,148 KB
testcase_07 AC 122 ms
42,116 KB
testcase_08 AC 136 ms
42,312 KB
testcase_09 AC 129 ms
42,500 KB
testcase_10 AC 127 ms
41,928 KB
testcase_11 AC 130 ms
42,172 KB
testcase_12 AC 140 ms
42,288 KB
testcase_13 AC 127 ms
42,080 KB
testcase_14 AC 134 ms
42,356 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 119 ms
42,104 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 126 ms
41,912 KB
testcase_23 AC 120 ms
41,540 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 125 ms
42,244 KB
testcase_27 AC 130 ms
41,900 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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(p == 0){
			return 1;
		}else if(p == 1){
			return a % MOD;
		}else if(p % 2 != 0){
			return (a * 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]);
		//System.out.println("out");
		
		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