結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
Maricom_tkg
|
| 提出日時 | 2018-11-03 17:54:57 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 584 bytes |
| コンパイル時間 | 14,137 ms |
| コンパイル使用メモリ | 379,192 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-27 19:43:29 |
| 合計ジャッジ時間 | 14,139 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
use std::io::Read;
use std::cmp;
fn main() {
let mut buf = String::new();
std::io::stdin().read_to_string(&mut buf).unwrap();
let mut iter = buf.split_whitespace();
iter.next();
let sushi_lane = iter.map(|v| v.parse::<usize>().unwrap());
let mut max_one_before: usize = 0;
let mut max_two_before: usize = 0;
for sushi in sushi_lane {
let cur_max: usize = cmp::max(sushi + max_two_before, max_one_before);
max_two_before = max_one_before;
max_one_before = cur_max;
}
println!("{}", max_one_before);
}
Maricom_tkg