Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- a = input()
- a = a.split()
- a = list(map(int, a))
- count = 0
- while len(a) > 0:
- if (100 in a) and (50 in a):
- a.remove(100)
- a.remove(50)
- count += 1
- elif (100 in a):
- a.remove(100)
- count += 1
- else:
- if a.count(50) > 2:
- a.remove(50)
- a.remove(50)
- a.remove(50)
- count += 1
- elif a.count(50) == 2:
- a.remove(50)
- a.remove(50)
- count += 1
- else:
- a.remove(50)
- count += 1
- print(count)
Advertisement
Add Comment
Please, Sign In to add comment