結果
問題 | No.2007 Arbitrary Mod (Easy) |
ユーザー |
|
提出日時 | 2022-11-23 15:33:58 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 66 ms / 2,000 ms |
コード長 | 462 bytes |
コンパイル時間 | 330 ms |
コンパイル使用メモリ | 7,072 KB |
実行使用メモリ | 39,296 KB |
最終ジャッジ日時 | 2024-09-24 19:41:08 |
合計ジャッジ時間 | 5,869 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
function modPow(a, n, m) {let r = BigInt(1);while (n > 0n) {if (n & 1n) r = r * a % m;a = a * a % m;n >>= 1n;}return r;}function Main(input) {let src = input.replace("\n", "").split(" ");const a = BigInt(src[0]);const n = BigInt(src[1]);const m = BigInt(998244353);console.log(Number(m));console.log(Number(modPow(a, n, m)));}Main(require("fs").readFileSync("/dev/stdin", "utf8"));