結果

問題 No.2600 Avator Height
ユーザー ⁣
提出日時 2024-07-24 16:19:02
言語 Rust
(1.77.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 12,556 ms
コンパイル使用メモリ 386,632 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-24 16:19:19
合計ジャッジ時間 16,382 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,816 KB
testcase_01 AC 44 ms
6,816 KB
testcase_02 AC 35 ms
6,944 KB
testcase_03 AC 47 ms
6,940 KB
testcase_04 AC 39 ms
6,944 KB
testcase_05 AC 36 ms
6,940 KB
testcase_06 AC 36 ms
6,944 KB
testcase_07 AC 36 ms
6,944 KB
testcase_08 AC 36 ms
6,944 KB
testcase_09 AC 36 ms
6,944 KB
testcase_10 AC 38 ms
6,944 KB
testcase_11 AC 38 ms
6,944 KB
testcase_12 AC 40 ms
6,940 KB
testcase_13 AC 43 ms
6,944 KB
testcase_14 AC 47 ms
6,940 KB
testcase_15 AC 39 ms
6,940 KB
testcase_16 AC 37 ms
6,940 KB
testcase_17 AC 35 ms
6,944 KB
testcase_18 AC 36 ms
6,944 KB
testcase_19 AC 35 ms
6,940 KB
testcase_20 AC 36 ms
6,944 KB
testcase_21 AC 36 ms
6,940 KB
testcase_22 AC 35 ms
6,944 KB
testcase_23 AC 38 ms
6,940 KB
testcase_24 AC 26 ms
6,944 KB
testcase_25 AC 30 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{stdin, stdout, BufWriter, Write};

fn g() -> usize {
	let mut s = String::new();
	stdin().read_line(&mut s).ok();
	s.trim().parse().unwrap()
}
fn main() {
	let (d, mut r, mut e) = (998244353u64, vec![0; 200001], vec![0; 200001]);
	(r[1], r[2], e[1], e[2]) = (1, 1, 1, 3);
	for i in 3..r.len() {
		r[i] = (r[i - 1] + r[i - 2]) % d;
		e[i] = (e[i - 1] + e[i - 2]) % d;
	}
	let mut w = BufWriter::new(stdout());
	for _ in 0..g() {
		let n = g();
		writeln!(w, "{}", ((5 * r[n] * r[n] + d) - e[n] * e[n] % d) % d).ok();
	}
}
0