mfgnik

Untitled

May 26th, 2020
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. amount_numbers, exchanges = map(int, input().split())
  2. current = amount_numbers
  3. numbers = []
  4. while exchanges >= current - 1 and exchanges:
  5.     numbers.append(current)
  6.     exchanges -= current - 1
  7.     current -= 1
  8. to_extend = list(range(1, current + 1))
  9. to_extend[0], to_extend[exchanges] = to_extend[exchanges], to_extend[0]
  10. numbers.extend(to_extend)
  11. print(*numbers)
Advertisement
Add Comment
Please, Sign In to add comment