結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2016-05-01 00:22:09 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 726 bytes |
コンパイル時間 | 16,004 ms |
コンパイル使用メモリ | 376,984 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 01:58:47 |
合計ジャッジ時間 | 14,181 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
コンパイルメッセージ
warning: function `get_words` is never used --> src/main.rs:11:4 | 11 | fn get_words() -> Vec<String> { | ^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default
ソースコード
// yukicoder My Practice // author: Leonardone @ NEETSDKASU use std::io; fn get_line() -> String { let mut input = String::new(); io::stdin().read_line(&mut input).ok().expect(""); return String::from(input.trim()); } fn get_words() -> Vec<String> { get_line() .split_whitespace() .map(String::from) .collect() } fn get_integers() -> Vec<i32> { get_line() .split_whitespace() .map(|x| String::from(x).parse::<i32>().unwrap()) .collect() } fn main() { let _ = get_line(); let nums = get_integers(); let (ans, _) = nums .iter() .fold((0,0), |(ans, mx), &x| { let mx2 = std::cmp::max(mx, x); let an2 = if ans < x && x < mx2 { x } else { ans }; (an2, mx2) }); println!("{}", ans); }