結果
| 問題 |
No.403 2^2^2
|
| コンテスト | |
| ユーザー |
ぴろず
|
| 提出日時 | 2016-07-22 23:14:07 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 163 ms / 2,000 ms |
| コード長 | 660 bytes |
| コンパイル時間 | 2,598 ms |
| コンパイル使用メモリ | 77,072 KB |
| 実行使用メモリ | 42,752 KB |
| 最終ジャッジ日時 | 2024-11-06 15:16:45 |
| 合計ジャッジ時間 | 8,504 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
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;
if (a.mod(MOD).equals(BigInteger.ZERO)) { //0^0対策
y = BigInteger.ZERO;
}else{
y = a.modPow(b.modPow(c, MOD.subtract(BigInteger.ONE)), MOD);
}
System.out.println(x + " " + y);
}
}
ぴろず