結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー CuriousFairy315CuriousFairy315
提出日時 2022-07-15 21:23:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 71,764 KB
実行使用メモリ 56,432 KB
最終ジャッジ日時 2023-09-10 00:24:53
合計ジャッジ時間 10,427 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,876 KB
testcase_01 AC 125 ms
56,252 KB
testcase_02 AC 126 ms
55,524 KB
testcase_03 AC 126 ms
55,744 KB
testcase_04 AC 124 ms
55,572 KB
testcase_05 AC 125 ms
56,020 KB
testcase_06 AC 121 ms
55,792 KB
testcase_07 AC 121 ms
56,268 KB
testcase_08 AC 124 ms
55,548 KB
testcase_09 AC 123 ms
56,152 KB
testcase_10 AC 123 ms
55,872 KB
testcase_11 AC 124 ms
55,768 KB
testcase_12 AC 121 ms
56,172 KB
testcase_13 AC 128 ms
56,036 KB
testcase_14 AC 126 ms
55,548 KB
testcase_15 AC 127 ms
55,548 KB
testcase_16 AC 124 ms
55,716 KB
testcase_17 AC 124 ms
56,020 KB
testcase_18 AC 122 ms
56,296 KB
testcase_19 AC 125 ms
55,892 KB
testcase_20 AC 125 ms
55,560 KB
testcase_21 AC 126 ms
55,788 KB
testcase_22 AC 124 ms
56,432 KB
testcase_23 AC 126 ms
55,816 KB
testcase_24 AC 123 ms
55,864 KB
testcase_25 AC 126 ms
55,832 KB
testcase_26 AC 126 ms
55,712 KB
testcase_27 AC 128 ms
56,188 KB
testcase_28 AC 126 ms
55,912 KB
testcase_29 AC 124 ms
55,856 KB
testcase_30 AC 126 ms
55,796 KB
testcase_31 AC 126 ms
55,592 KB
testcase_32 AC 124 ms
55,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


import static java.lang.System.err;
import static java.lang.System.out;

public class Main {
	public static void main(String[] args) {
		new Main();
		out.flush();
		err.flush();
	}
	
	public static long pow(long a, long b, int M) {
		if (b == 0) return 1;
		if (b == 1) return a % M;
		if (b == 2) return a * a % M;
		return pow(pow(a, 2, M), b >> 1, M) * pow(a, b & 1, M) % M;
	}

	public Main() {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			int a = sc.nextInt();
			long n = sc.nextLong();
			final int M = 998_244_353;
			out.println(M);
			out.println(pow(a, n, M));
		}
	}
}
0