Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- amount_numbers, exchanges = map(int, input().split())
- current = amount_numbers
- numbers = []
- while exchanges >= current - 1 and current:
- numbers.append(current)
- exchanges -= current - 1
- current -= 1
- to_extend = list(range(1, current + 1))
- to_extend[0], to_extend[exchanges] = to_extend[exchanges], to_extend[0]
- numbers.extend(to_extend)
- print(*numbers)
Advertisement
Add Comment
Please, Sign In to add comment