結果
問題 | No.44 DPなすごろく |
ユーザー |
|
提出日時 | 2024-09-17 17:48:22 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 11,067 ms |
コンパイル使用メモリ | 399,756 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-17 17:48:46 |
合計ジャッジ時間 | 11,971 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
warning: unused `Result` that must be used --> src/main.rs:19:5 | 19 | writeln!(stdout, "{}", dp[n]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default = note: this warning originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
ソースコード
use std::io;use std::io::prelude::*;fn main() {let stdin = io::read_to_string(io::stdin()).unwrap();let mut stdin = stdin.split_ascii_whitespace();let stdout = io::stdout();let mut stdout = io::BufWriter::new(stdout.lock());let n: usize = stdin.next().unwrap().parse::<usize>().unwrap();let mut dp = vec![0u64; 51];dp[0] = 1;dp[1] = 1;for i in 2..=50 {dp[i] = dp[i - 1] + dp[i - 2];}writeln!(stdout, "{}", dp[n]);}