結果
問題 | No.2007 Arbitrary Mod (Easy) |
ユーザー |
![]() |
提出日時 | 2022-07-15 21:23:08 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 131 ms / 2,000 ms |
コード長 | 607 bytes |
コンパイル時間 | 2,006 ms |
コンパイル使用メモリ | 74,380 KB |
実行使用メモリ | 41,764 KB |
最終ジャッジ日時 | 2024-06-27 16:44:40 |
合計ジャッジ時間 | 8,669 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
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));}}}