ccf201604-1折点计数(python100分)
作者:互联网
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(1,n-1):
if((a[i]>a[i-1] and a[i]>a[i+1]) or (a[i]<a[i-1] and a[i]<a[i+1])):
#既然是折点,那么就是折点附近的两个点大于、小于折点的值
count = count + 1
print(count)
嗷嗷,输入输出终于不报错啦!!!鼓掌鼓掌!!!!
标签:count,map,ccf201604,int,折点,报错,鼓掌,input,python100 来源: https://blog.csdn.net/swing123lovecoding/article/details/120471301