結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー tabataba
提出日時 2024-08-01 10:22:34
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 337 bytes
コンパイル時間 11,541 ms
コンパイル使用メモリ 401,880 KB
実行使用メモリ 28,628 KB
最終ジャッジ日時 2024-08-01 10:22:54
合計ジャッジ時間 18,535 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,752 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 22 ms
5,376 KB
testcase_09 AC 209 ms
5,376 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused imports: `BTreeSet`, `HashMap`, `hash::Hash`
 --> src/main.rs:2:19
  |
2 |     collections::{BTreeSet, HashMap},
  |                   ^^^^^^^^  ^^^^^^^
3 |     hash::Hash,
  |     ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

ソースコード

diff #

use std::{
    collections::{BTreeSet, HashMap},
    hash::Hash,
};

fn main() {
    proconio::input! {
        n: usize,
        m: u32,
    }
    let mut fib = vec![0, 1];
    for _ in 0..n - 2 {
        fib.push((fib[fib.len() - 1] + fib[fib.len() - 2]) % m);
    }
    eprintln!("{fib:?}");
    println!("{}", fib[fib.len() - 1]);
}
0