結果
| 問題 |
No.365 ジェンガソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-05-01 06:15:49 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 701 bytes |
| コンパイル時間 | 13,351 ms |
| コンパイル使用メモリ | 399,132 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 01:59:32 |
| 合計ジャッジ時間 | 13,139 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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|
if x > mx { (ans, x) }
else { if ans < x { (x, mx) } else { (ans, mx) } }
);
println!("{}", ans);
}