ofcRS

Untitled

Nov 1st, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. n = int(input())
  2. a = input()
  3. a = a.split()
  4. a = list(map(int, a))
  5. count = 0
  6. while len(a) > 0:
  7.     if (100 in a) and (50 in a):
  8.         a.remove(100)
  9.         a.remove(50)
  10.         count += 1
  11.     elif (100 in a):
  12.         a.remove(100)
  13.         count += 1
  14.     else:
  15.         if a.count(50) > 2:
  16.             a.remove(50)
  17.             a.remove(50)
  18.             a.remove(50)
  19.             count += 1
  20.         elif a.count(50) == 2:
  21.             a.remove(50)
  22.             a.remove(50)
  23.             count += 1
  24.         else:
  25.             a.remove(50)
  26.             count += 1
  27. print(count)
Advertisement
Add Comment
Please, Sign In to add comment