全排列问题
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Problem Description
Output, in lexicographic order, all non-repeating permutations of the natural numbers to , i.e., the full set of permutations of to . No generated sequence may contain repeated numbers.
Input Format
A single integer .
Output Format
All non-repeating sequences composed of , one sequence per line. Each number should be printed in a field of width .
3
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
Hint
。
Translated by ChatGPT 5