結果

問題 No.116 門松列(1)
ユーザー _Clay_____Clay____
提出日時 2018-10-13 17:07:48
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 999 ms
コンパイル使用メモリ 151,808 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 20:06:49
合計ジャッジ時間 1,769 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 1 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn main() {
  let mut buf = String::new();
  io::stdin().read_line(&mut buf).ok();

  let mut buf = String::new();
  io::stdin().read_line(&mut buf).ok();
  let a: Vec<u16> = buf
    .trim()
    .split_whitespace()
    .map(|e| e.parse().ok().unwrap())
    .collect();

  let mut result = 0;

  for v in a.windows(3) {
    let &max = v.iter().max().unwrap();
    let &min = v.iter().min().unwrap();

    if v[1] == max || v[1] == min {
      result += 1;
    }
  }
  println!("{}", result);
}
0