TopCoder

User's AC Ratio

100.0% (2/2)

Submission's AC Ratio

50.0% (2/4)

Tags

Description

給你一個數字 $n$ ,照字典序印出 $1$ 到 $n$ 的所有排列,但 $1$ 跟 $n$ 不能相鄰

Input Format

輸入只有一行,為一個正整數 $n$ $(2 \le n \le 9)$

Output Format

Sample Input 1

3

Sample Output 1

1 2 3
3 2 1

Hints

Problem Source

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536
1 1000 65536 65536
2 1000 65536 65536
3 1000 65536 65536
4 1000 65536 65536
5 1000 65536 65536
6 1000 65536 65536
7 1000 65536 65536