#34957: Python解


popo0816@apps.ntpc.edu.tw (壽溥謙)

學校 : 龍華科技大學
編號 : 214606
來源 : [210.70.98.252]
最後登入時間 :
2024-11-19 13:34:22
c199. 爬山去(Hiking)-TOI練習賽y7m5-1 -- 2017TOI5月練習賽 | From: [118.160.82.150] | 發表日期 : 2023-04-29 15:31

hl = input()
hlList = hl.split()
total = 0
i = 2
while i < len(hlList)-1:
    if int(hlList[i]) == int(hlList[i+1]):
        hlList.pop(i+1)
    if int(hlList[i]) == int(hlList[i-1]):
        hlList.pop(i-1)
    i += 1
for j in range(2,len(hlList)-1):
    if int(hlList[j]) > int(hlList[j+1]) and int(hlList[j]) > int(hlList[j-1]):
        total += 1
print(total)

 
ZeroJudge Forum