結果

問題 No.116 門松列(1)
ユーザー konabe
提出日時 2018-05-04 06:48:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 403 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-25 01:41:40
合計ジャッジ時間 1,675 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

def isKadomatsu(a, b, c):
    l = [a, b, c]
    if len(l) != len(set(l)):
        return False
    sl = sorted(l)
    if sl[1] == a or sl[1] == c:
        return True
    else:
        return False

N = input()
K = list(map(int, input().split()))

res = 0
for i, Ki in enumerate(K):
    if i == 0 or i == len(K) - 1:
        continue
    if isKadomatsu(K[i-1], K[i], K[i+1]):
        res += 1
print(res)
0