結果

問題 No.44 DPなすごろく
ユーザー cra77756176
提出日時 2022-11-18 22:56:10
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 14,720 ms
コンパイル使用メモリ 376,940 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-20 03:23:48
合計ジャッジ時間 13,806 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufRead};

fn main() {
    let input = io::stdin()
        .lock()
        .lines()
        .map(|l| {
            l.unwrap()
                .split_whitespace()
                .map(std::string::ToString::to_string)
                .collect::<Vec<_>>()
        })
        .collect::<Vec<_>>();

    let goal = input[0][0].parse::<u64>().unwrap();

    let mut f1 = 0u64;
    let mut f2 = 1u64;
    for _ in 0..goal {
        let tmp = f2;
        f2 += f1;
        f1 = tmp;
    }

    println!("{}", f2);
}
0