結果

問題 No.403 2^2^2
ユーザー ぴろずぴろず
提出日時 2016-07-22 22:43:20
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 623 bytes
コンパイル時間 2,200 ms
コンパイル使用メモリ 76,420 KB
実行使用メモリ 55,128 KB
最終ジャッジ日時 2024-04-24 02:24:44
合計ジャッジ時間 7,859 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
42,392 KB
testcase_01 AC 154 ms
42,672 KB
testcase_02 AC 153 ms
42,212 KB
testcase_03 AC 154 ms
42,656 KB
testcase_04 AC 152 ms
42,424 KB
testcase_05 AC 154 ms
42,624 KB
testcase_06 AC 155 ms
42,524 KB
testcase_07 AC 153 ms
42,140 KB
testcase_08 AC 152 ms
42,524 KB
testcase_09 AC 153 ms
42,684 KB
testcase_10 AC 153 ms
42,644 KB
testcase_11 AC 154 ms
42,264 KB
testcase_12 AC 153 ms
42,320 KB
testcase_13 AC 157 ms
42,240 KB
testcase_14 AC 140 ms
42,092 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 155 ms
42,204 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 139 ms
41,872 KB
testcase_23 AC 150 ms
42,524 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 154 ms
42,604 KB
testcase_27 AC 153 ms
42,328 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package no403;

import java.util.Scanner;

public class Main {
	public static long MOD = 1000000007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("\\^");
		long a = Long.parseLong(s[0]);
		long b = Long.parseLong(s[1]);
		long c = Long.parseLong(s[2]);
		long x = pow(pow(a,b,MOD),c,MOD);
		long y = pow(a,pow(b,c,MOD-1),MOD);
		System.out.println(x + " " + y);
	}
	public static long pow(long a,long n,long mod) {
		long res = 1;
		while(n > 0) {
			if ((n & 1) > 0) {
				res = (res * a) % mod;
			}
			a = (a * a) % mod;
			n/=2;
		}
		return res;
	}
}
0