結果

問題 No.403 2^2^2
ユーザー TatsuDXTatsuDX
提出日時 2016-09-03 18:04:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 696 bytes
コンパイル時間 3,088 ms
コンパイル使用メモリ 78,876 KB
実行使用メモリ 55,036 KB
最終ジャッジ日時 2024-04-27 15:37:58
合計ジャッジ時間 8,107 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
54,704 KB
testcase_01 AC 137 ms
54,636 KB
testcase_02 AC 132 ms
54,732 KB
testcase_03 AC 126 ms
54,380 KB
testcase_04 AC 140 ms
54,852 KB
testcase_05 AC 139 ms
55,000 KB
testcase_06 AC 147 ms
54,816 KB
testcase_07 AC 144 ms
54,872 KB
testcase_08 AC 136 ms
54,580 KB
testcase_09 AC 145 ms
54,796 KB
testcase_10 AC 143 ms
54,688 KB
testcase_11 AC 124 ms
54,516 KB
testcase_12 AC 145 ms
54,852 KB
testcase_13 AC 139 ms
54,996 KB
testcase_14 AC 142 ms
55,004 KB
testcase_15 AC 138 ms
54,776 KB
testcase_16 AC 139 ms
54,868 KB
testcase_17 AC 129 ms
54,564 KB
testcase_18 AC 127 ms
54,496 KB
testcase_19 AC 138 ms
54,940 KB
testcase_20 AC 137 ms
54,272 KB
testcase_21 AC 133 ms
54,256 KB
testcase_22 AC 123 ms
54,320 KB
testcase_23 AC 126 ms
54,248 KB
testcase_24 AC 135 ms
54,936 KB
testcase_25 AC 127 ms
54,412 KB
testcase_26 AC 147 ms
55,036 KB
testcase_27 AC 124 ms
54,552 KB
testcase_28 AC 145 ms
54,668 KB
testcase_29 AC 136 ms
54,456 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