#46256: 最多壓成這樣


ck11200428@gl.ck.tp.edu.tw (ck11200428張毓軒)

學校 : 臺北市立建國高級中學
編號 : 310125
來源 : [122.116.111.175]
最後登入時間 :
2025-08-28 22:07:10

from itertools import permutations

n = int(input())
for p in permutations(range(1, n+1)):
    print(' '.join(map(str, p)))

 

from itertools import permutations
print(*[' '.join(map(str, k)) for k in permutations(range(1, int(input())+1))], sep='\n')
也可以但是會把記憶體炸掉只能90%