Guest User

Наибольшая пилообразная подпоследовательность

a guest
Jan 12th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. n=int(input())
  2. a=[]*n
  3. f=0
  4. a = list(map(int, input().split()))
  5. for i in range(1,n-2):
  6. if a[i]>a[i+1] and a[i]>a[i-1] or a[i]<a[i+1] and a[i]<a[i-1]:
  7. f+=0
  8. else:
  9. f+=1
  10. print(f)
Add Comment
Please, Sign In to add comment