Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. n = int(input())
  2.  
  3. star = list(map(int, input().split()))
  4.  
  5. attacked = 1
  6. count = 0
  7.  
  8.  
  9. while True:
  10. if count < 0 or count == n:
  11. break
  12. else:
  13. if star[count] == 0:
  14. break
  15. elif star[count] % 2 == 0:
  16. star[count] -= 1
  17. count = count - 1
  18. else:
  19. star[count] -= 1
  20. count = count + 1
  21. attacked += 1
  22. print(attacked)
  23. print(sum(star))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement