結果

問題 No.116 門松列(1)
ユーザー あかりき
提出日時 2021-02-09 21:42:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 197 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,860 KB
実行使用メモリ 53,700 KB
最終ジャッジ日時 2024-07-07 03:40:27
合計ジャッジ時間 1,821 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
ct=0
for i in range(n-2):
  x=a[i];y=a[i+1];z=a[i+2]
  l=[x,y,z]
  l.sort()
  if x!=y and y!=z and z!=x and (l[1]==x or l[1]==z):
    ct+=1
print(ct)
0