結果

問題 No.403 2^2^2
ユーザー ぴろず
提出日時 2016-07-22 23:08:49
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 2,467 ms
コンパイル使用メモリ 76,452 KB
実行使用メモリ 55,144 KB
最終ジャッジ日時 2024-11-06 09:20:02
合計ジャッジ時間 8,173 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

package no403;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static BigInteger MOD = BigInteger.valueOf(1000000007);
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("\\^");
		BigInteger a = new BigInteger(s[0]);
		BigInteger b = new BigInteger(s[1]);
		BigInteger c = new BigInteger(s[2]);
		BigInteger x = a.modPow(b, MOD).modPow(c, MOD);
		BigInteger y = a.modPow(b.modPow(c, MOD.subtract(BigInteger.ONE)), MOD);
		System.out.println(x + " " + y);
	}
}
0