結果

問題 No.1476 esreveR dna esreveR
ユーザー ks2mks2m
提出日時 2021-04-16 21:01:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 3,679 ms
コンパイル使用メモリ 71,152 KB
実行使用メモリ 56,352 KB
最終ジャッジ日時 2023-09-15 22:29:20
合計ジャッジ時間 4,660 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,704 KB
testcase_01 AC 120 ms
55,700 KB
testcase_02 AC 120 ms
55,692 KB
testcase_03 AC 121 ms
55,680 KB
testcase_04 AC 120 ms
55,840 KB
testcase_05 AC 119 ms
55,648 KB
testcase_06 AC 120 ms
56,216 KB
testcase_07 AC 119 ms
56,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		sc.close();

		long n2 = n / 2;
		System.out.println(power(6, n2, 998244353));
	}

	static long power(long x, long n, int m) {
		if (n == 0) {
			return 1;
		}
		long val = power(x, n / 2, m);
		val = val * val % m;
		if (n % 2 == 1) {
			val = val * x % m;
		}
		return val;
	}
}
0