結果

問題 No.116 門松列(1)
ユーザー soupesuteakasoupesuteaka
提出日時 2016-03-03 17:40:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2023-09-07 06:54:55
合計ジャッジ時間 1,746 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
9,164 KB
testcase_01 AC 25 ms
9,200 KB
testcase_02 AC 25 ms
9,216 KB
testcase_03 AC 25 ms
9,288 KB
testcase_04 AC 25 ms
9,248 KB
testcase_05 AC 25 ms
9,204 KB
testcase_06 AC 25 ms
9,136 KB
testcase_07 AC 25 ms
9,240 KB
testcase_08 AC 26 ms
9,304 KB
testcase_09 AC 25 ms
9,268 KB
testcase_10 AC 26 ms
9,308 KB
testcase_11 AC 26 ms
9,196 KB
testcase_12 AC 30 ms
9,080 KB
testcase_13 AC 25 ms
9,300 KB
testcase_14 AC 26 ms
9,132 KB
testcase_15 AC 25 ms
9,144 KB
testcase_16 AC 26 ms
9,164 KB
testcase_17 AC 26 ms
9,344 KB
testcase_18 AC 26 ms
9,200 KB
testcase_19 AC 26 ms
9,156 KB
testcase_20 AC 26 ms
9,168 KB
testcase_21 AC 26 ms
9,132 KB
testcase_22 AC 25 ms
9,128 KB
testcase_23 AC 25 ms
9,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: UTF-8

import sys
import re
import itertools
from math import log
from collections import deque

### defs ###
def monmatsu(A):
	mn = min(A)
	mx = max(A)
	if (A[0]==A[1] or A[0]==A[2] or A[1]==A[2]):
		return False
	if (A[1]!=mn and A[1]!=mx):
		return False
	else:
		return True

### main ###
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

ans=0
for i in range(N-2):
	if (monmatsu(A[i:i+3])):
		ans+=1
print(ans)
0