Home => ProblemSet => 5.1-01: 数字全排列
Problem1275--5.1-01: 数字全排列

1275: 5.1-01: 数字全排列

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 2  Solved: 8
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

给定一个整数n,将数字1~n排成一排,将会有很多种排列方法。
现在,请你按照字典序将所有的排列方法输出。

Input

共一行,包含一个整数n。

Output

按字典序输出所有排列方案,每个方案占一行。

Sample Input Copy

3

Sample Output Copy

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

HINT

1≤n≤7

Source/Category