STL Practice —— 【prev_permutation&next_permutation (1)】
Time Limit: 5 s
Memory Limit: 32 MB
Submission:439
AC:145
Score:96.27
Description
给出一个数字N,先按字典序从小到大输出1-N的全排列,再按字典序从大到小输出1-N的全排列。
Input
输入有多组测试数据,每组测试数据包含一个正整数N(1<=N<=8)。
Output
题目描述的全排列,每组测试数据之后加一个空行。详细输出格式见样例。
Samples
input
2
3
output
12
21
21
12
123
132
213
231
312
321
321
312
231
213
132
123
Hint
大量输出和换行,请用"\n"替换endl。(建议使用scanf和printf进行输入输出)
Author