結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー
提出日時 2024-05-24 17:21:52
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 13,445 ms
コンパイル使用メモリ 384,336 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-20 19:27:44
合計ジャッジ時間 14,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	let n: Vec<u32> = s.split_whitespace().flat_map(str::parse).collect();
	let (mut a, mut b) = (1, 0);
	(2..n[0]).for_each(|_| (a, b) = ((a + b) % n[1], a));
	println!("{}", a)
}
0