Advertisement
daegron

4

Nov 2nd, 2021
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. def sol(dep, n):
  2.     commission = 0
  3.     for i in range(n - 1):
  4.  
  5.         first_min = min(dep)
  6.         dep.remove(first_min)
  7.  
  8.         second_min = min(dep)
  9.         dep.remove(second_min)
  10.  
  11.         new_dep = first_min + second_min
  12.         commission += new_dep * 0.05
  13.  
  14.         dep.append(new_dep)
  15.  
  16.     return commission
  17.  
  18.  
  19. n = int(input())
  20. deposit = [int(i) for i in input().split()]
  21. print(sol(deposit, n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement