Type: Default 1000ms 256MiB

全排列问题

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

Description

输出自然数 1 到n 所有不重复的排列,即 n 的全排列,要求所产生的任一数字序列中不允许出现重复的数字。

Format

Input

n(1≤n<9)

Output

由 1~n 组成的所有不重复的数字序列,每行一个序列。注意,每个数前面输出4个空格,包括第一个数。

Samples

3
    1    2    3
    1    3    2
    2    1    3
    2    3    1
    3    1    2
    3    2    1

Limitation

1s, 1024KiB for each test case.

深度优先搜索

Not Claimed
Status
Done
Problem
7
Open Since
2024-10-16 0:00
Deadline
2024-12-11 23:59
Extension
24 hour(s)