求求各位大哥,90分
  • 板块P1317 低洼地
  • 楼主ErgouTree
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/12/27 16:44
  • 上次更新2023/12/27 20:33:03
查看原帖
求求各位大哥,90分
1216518
ErgouTree楼主2023/12/27 16:44
n = int(input())
height = [int(x) for x in input().split()]
result = 0.0

for h in range(1, n-1):
    if height[h] < height[h + 1] and height[h] < height[h - 1]:
        result += 1
    elif height[h] == height[h + 1]:
        if height[h] < height[h - 1]:
            result += 0.5
    elif height[h] == height[h - 1]:
        if height[h] < height[h + 1]:
            result += 0.5

print(int(result))
2023/12/27 16:44
加载中...