Ответ:
n, k = map(int, input().split())
a = []
for i in range(1, n+1):
a.append(i)
def bubble_change(a):
global k
n = len(a)
for i in range(k):
if a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
else:
k += 1
bubble_change(a)
print(' '.join(map(str, a)))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
n, k = map(int, input().split())
a = []
for i in range(1, n+1):
a.append(i)
def bubble_change(a):
global k
n = len(a)
for i in range(k):
if a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
else:
k += 1
bubble_change(a)
print(' '.join(map(str, a)))