Advertisement
viligen

social_distribution

Oct 18th, 2021
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. input_numbers = list(map(int, input().split(", ")))
  2. wealth = int(input())
  3. filtered = []
  4. for num in input_numbers:
  5.     if num < wealth and (max(input_numbers) + num) >= 2 * wealth:
  6.         index_max = input_numbers.index(max(input_numbers))
  7.         input_numbers[index_max] = max(input_numbers) - (wealth - num)
  8.         num = wealth
  9.     filtered.append(num)
  10.  
  11. if len([n for n in filtered if n >= wealth]) == len(input_numbers):
  12.     print(filtered)
  13. else:
  14.     print("No equal distribution possible")
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement