結果
| 問題 |
No.116 門松列(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-17 21:54:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 5,000 ms |
| コード長 | 276 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 82,316 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-06-11 15:39:38 |
| 合計ジャッジ時間 | 1,729 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
N = int(input())
lsA = list(map(int,input().split()))
cnt = 0
for i in range(N-2):
if lsA[i] < lsA[i+1] and lsA[i+1] > lsA[i+2] and lsA[i] != lsA[i+2]:
cnt += 1
elif lsA[i] > lsA[i+1] and lsA[i+1] < lsA[i+2] and lsA[i] != lsA[i+2]:
cnt += 1
print(cnt)