結果

問題 No.116 門松列(1)
コンテスト
ユーザー ktshun
提出日時 2015-05-29 16:58:30
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 359 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 124 ms
コンパイル使用メモリ 77,364 KB
最終ジャッジ日時 2025-12-03 15:20:31
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding:utf-8 -*-

if __name__ == "__main__":
	n = input()
	take = map(int,raw_input().split())
	ans = 0
	for i in xrange(1,n-1):
		if (take[i] > take[i-1] and take[i] < take[i+1]) or (take[i] < take[i-1] and take[i] > take[i+1]):
			continue
		if take[i] == take[i+1] or take[i] == take[i-1] or take[i+1] == take[i-1]:
			continue
		ans += 1
	print ans
0