結果

問題 No.657 テトラナッチ数列 Easy
ユーザー ixTL255ixTL255
提出日時 2023-01-17 23:42:49
言語 Rust
(1.77.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 675 ms
コンパイル使用メモリ 142,384 KB
実行使用メモリ 9,764 KB
最終ジャッジ日時 2023-09-01 03:20:53
合計ジャッジ時間 2,093 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
9,736 KB
testcase_01 AC 10 ms
9,712 KB
testcase_02 AC 10 ms
9,744 KB
testcase_03 AC 10 ms
9,712 KB
testcase_04 AC 10 ms
9,676 KB
testcase_05 AC 22 ms
9,712 KB
testcase_06 AC 10 ms
9,712 KB
testcase_07 AC 10 ms
9,744 KB
testcase_08 AC 10 ms
9,744 KB
testcase_09 AC 24 ms
9,744 KB
testcase_10 AC 24 ms
9,764 KB
testcase_11 AC 23 ms
9,748 KB
testcase_12 AC 24 ms
9,752 KB
testcase_13 AC 25 ms
9,756 KB
testcase_14 AC 25 ms
9,704 KB
testcase_15 AC 25 ms
9,716 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `i`
  --> Main.rs:14:9
   |
14 |     for i in 0..q {
   |         ^ help: if this is intentional, prefix it with an underscore: `_i`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn main() {
    let mut q = String::new();
    std::io::stdin().read_line(&mut q).ok();
    let q:usize = q.trim().parse().unwrap();

    let mut tetranacci: Vec<usize> = vec![0, 0, 0, 1];

    for i in 0..999996{
        tetranacci.push(
            (tetranacci[i] + tetranacci[i + 1] + tetranacci[i + 2] + tetranacci[i + 3]) % 17
        );
    }

    for i in 0..q {
        let mut n = String::new();
        std::io::stdin().read_line(&mut n).ok();
        let n:usize = n.trim().parse().unwrap();
        println!("{}", tetranacci[n - 1] % 17);
    }
}
0