DeukausGames

Escadinha OBI

Aug 22nd, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. # escadinha
  2. # fase 1
  3. # obi 2018
  4. # python
  5. # by Deukaus / Matheus Santos
  6.  
  7. # https://olimpiada.ic.unicamp.br/pratique/p1/2018/f1/escadinha/
  8.  
  9. size = int(input())
  10. esc = 1
  11. if size < 1:
  12.     esc = 0
  13. n = input().split(" ")
  14. n = list(map(int, n))
  15. dif = 0
  16. if size == 1:
  17.     print(1)
  18. else:
  19.     for nums in range(1,size):
  20.         dif2 = n[nums] - n[nums-1]
  21.         if dif2 != dif:
  22.             dif = n[nums] - n[nums - 1]
  23.             esc += 1
  24.             print(esc)
Advertisement
Add Comment
Please, Sign In to add comment