Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open(r'26-109.txt')
- n = int(f.readline())
- a = [int(f.readline()) for _ in range(n)]
- a.sort()
- totalPrice = 0
- totalCount = 0
- for i in range(1, n+1):
- m = a[i-1::-1]
- discountIndex = i//6
- price = sum(m[:discountIndex])*0.5 + sum(m[discountIndex:])
- count = i
- if price <= 100_000:
- totalPrice = price
- totalCount = count
- print(totalCount, 100_000 - totalPrice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement