0
点赞
收藏
分享

微信扫一扫

CCF python 折点计数

IT程序员 2022-01-12 阅读 80
n = int(input())
list1 = list(map(int,input().split()))
num = 0
for i in range(1, n-1):
    if (list1[i-1] > list1[i] and (list1[i+1] > list1[i])) or\
            (list1[i-1] < list1[i] and (list1[i+1] < list1[i])):
        num = num + 1
print(num)
举报

相关推荐

0 条评论