結果

問題 No.657 テトラナッチ数列 Easy
ユーザー ixTL255
提出日時 2023-01-17 23:42:49
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 16,757 ms
コンパイル使用メモリ 379,444 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2025-01-03 05:41:47
合計ジャッジ時間 17,425 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `i`
  --> src/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

ソースコード

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