Advertisement
Guest User

Untitled

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