結果

問題 No.403 2^2^2
ユーザー TatsuDXTatsuDX
提出日時 2016-09-03 18:04:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 696 bytes
コンパイル時間 3,237 ms
コンパイル使用メモリ 75,788 KB
実行使用メモリ 57,052 KB
最終ジャッジ日時 2023-08-09 21:09:33
合計ジャッジ時間 8,804 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
56,836 KB
testcase_01 AC 143 ms
56,520 KB
testcase_02 AC 144 ms
56,852 KB
testcase_03 AC 138 ms
54,992 KB
testcase_04 AC 140 ms
56,580 KB
testcase_05 AC 152 ms
56,588 KB
testcase_06 AC 143 ms
56,636 KB
testcase_07 AC 139 ms
56,712 KB
testcase_08 AC 141 ms
56,720 KB
testcase_09 AC 141 ms
56,920 KB
testcase_10 AC 137 ms
56,532 KB
testcase_11 AC 143 ms
56,936 KB
testcase_12 AC 137 ms
56,956 KB
testcase_13 AC 137 ms
56,800 KB
testcase_14 AC 137 ms
55,160 KB
testcase_15 AC 136 ms
56,776 KB
testcase_16 AC 145 ms
56,852 KB
testcase_17 AC 138 ms
56,696 KB
testcase_18 AC 139 ms
57,052 KB
testcase_19 AC 142 ms
56,504 KB
testcase_20 AC 143 ms
56,828 KB
testcase_21 AC 143 ms
56,736 KB
testcase_22 AC 140 ms
56,528 KB
testcase_23 AC 142 ms
56,912 KB
testcase_24 AC 145 ms
57,008 KB
testcase_25 AC 144 ms
56,896 KB
testcase_26 AC 137 ms
56,832 KB
testcase_27 AC 137 ms
56,848 KB
testcase_28 AC 144 ms
56,500 KB
testcase_29 AC 138 ms
56,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String[] s = sc.nextLine().split("\\^");
		long a, b, c, tmp, x, y;
		a = Long.parseLong(s[0]) % e;
		b = Long.parseLong(s[1]);
		c = Long.parseLong(s[2]);

		tmp = ((b%(e-1))*(c%(e-1)))%(e-1);
		x = p(a, tmp, e);
		tmp = p(b%(e-1), c%(e/2-1), e-1);
		y = p(a, tmp, e);
		System.out.println(x + " " + y);
	}

	public static long e = 1000000007;
	public static long p(long a, long b, long m){
		a %= m;
		if(a == 0){
			return 0;
		} else if(b == 0){
			return 1;
		}
		if(b%2 == 0){
			return p(a*a, b/2, m)%m;
		} else {
			return (a * p(a*a, b/2, m))%m;
		}

	}
}
0