30分Python求助
查看原帖
30分Python求助
687108
Presisdent楼主2022/11/24 13:27

求解答


from itertools import permutations

n = int(input())

a = int(input())

init = input().strip().split()


all = []

index = 0
for i in permutations(init):
    all.append(i)
    index += 1
    if index > a:
        break

for i in all[-1]:
    print(i,end=' ')



2022/11/24 13:27
加载中...