Advertisement
qekaqeka

6262-ПОЛЯКОВ

Apr 24th, 2023
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. f = open(r'26-109.txt')
  2.  
  3. n = int(f.readline())
  4.  
  5. a = [int(f.readline()) for _ in range(n)]
  6.  
  7. a.sort()
  8.  
  9. totalPrice = 0
  10. totalCount = 0
  11.  
  12. for i in range(1, n+1):
  13. m = a[i-1::-1]
  14.  
  15. discountIndex = i//6
  16. price = sum(m[:discountIndex])*0.5 + sum(m[discountIndex:])
  17. count = i
  18. if price <= 100_000:
  19. totalPrice = price
  20. totalCount = count
  21.  
  22. print(totalCount, 100_000 - totalPrice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement