結果
問題 |
No.116 門松列(1)
|
ユーザー |
![]() |
提出日時 | 2018-10-13 18:44:08 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 636 bytes |
コンパイル時間 | 11,638 ms |
コンパイル使用メモリ | 402,936 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 01:45:08 |
合計ジャッジ時間 | 12,741 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
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) { result += match v { [a, b, c] if a > c => match (a, b, c) { (a, b, c) if b > a || b < c => 1, _ => 0, }, [a, b, c] if a < c => match (a, b, c) { (a, b, c) if b > c || b < a => 1, _ => 0, }, _ => 0, }; } println!("{}", result); }