結果

問題 No.116 門松列(1)
コンテスト
ユーザー toshiro_yanagi
提出日時 2018-06-04 12:54:37
言語 Nim
(2.2.6)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 207 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,581 ms
コンパイル使用メモリ 68,356 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-20 06:13:23
合計ジャッジ時間 3,501 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(7, 17) Warning: Number of spaces around '-' is not consistent [Spacing]
/home/judge/data/code/Main.nim(8, 11) Warning: Number of spaces around '-' is not consistent [Spacing]

ソースコード

diff #
raw source code

import strutils, sequtils

let N, A = stdin.readLine.split.map parseInt
var cnt = 0

for i in 1 ..< A.high:
  if (A[i] - A[i- 1]) * (A[i] - A[i + 1]) > 0:
    if A[i- 1] != A[i + 1]:
      cnt += 1

echo cnt
0