結果

問題 No.2600 Avator Height
ユーザー Maksym ShcherbanMaksym Shcherban
提出日時 2024-01-12 22:32:53
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 1,596 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 6,548 KB
実行使用メモリ 91,940 KB
最終ジャッジ日時 2024-01-12 22:33:40
合計ジャッジ時間 42,469 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 237 ms
65,584 KB
testcase_01 AC 1,521 ms
91,176 KB
testcase_02 AC 1,582 ms
91,424 KB
testcase_03 AC 1,588 ms
91,432 KB
testcase_04 AC 1,532 ms
91,432 KB
testcase_05 AC 1,522 ms
91,432 KB
testcase_06 AC 1,550 ms
91,940 KB
testcase_07 AC 1,577 ms
91,424 KB
testcase_08 AC 1,580 ms
91,432 KB
testcase_09 AC 1,580 ms
91,432 KB
testcase_10 AC 1,544 ms
91,432 KB
testcase_11 AC 1,576 ms
91,484 KB
testcase_12 AC 1,537 ms
91,384 KB
testcase_13 AC 1,562 ms
91,484 KB
testcase_14 AC 1,516 ms
91,484 KB
testcase_15 AC 1,596 ms
91,460 KB
testcase_16 AC 1,542 ms
91,432 KB
testcase_17 AC 1,542 ms
91,432 KB
testcase_18 AC 1,573 ms
91,624 KB
testcase_19 AC 1,537 ms
91,432 KB
testcase_20 AC 1,553 ms
91,432 KB
testcase_21 AC 1,549 ms
91,432 KB
testcase_22 AC 1,552 ms
91,460 KB
testcase_23 AC 1,558 ms
91,100 KB
testcase_24 AC 1,338 ms
62,012 KB
testcase_25 AC 1,490 ms
91,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
	const r = [1n, 1n];
	const e = [1n, 3n];
	const lines = input.split('\n').map(x => x.trim()).filter(Boolean);
	const mod = 998244353n;
	lines.slice(1).forEach(line => {
		const n = +line - 1;
		while (r.length <= n) {
			r.push((r.at(-1) + r.at(-2)) % mod);
			e.push((e.at(-1) + e.at(-2)) % mod);
		}
		const tmp = (5n * r[n] * r[n] - e[n] * e[n]);
		const result = ((tmp % mod) + mod) % mod;
		console.log(Number(result));
	});
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0