作者bztfir (我绝对没有P2个版)
看板b99902HW
标题[讨论] 去年双班的计程期中考题
时间Sat Nov 27 20:43:08 2010
Arrangement
Given an integer 1<=n<=15, list all the possible arrangements of 1,2,3,..,n
Output the arrangements with increasing order.
Input:
n1
n2
...
nt
Output:
all the possible arrangement
(Output each arrangement on a seperate line. Each number follow by a space.)
Example1
Input:
2
3
Output:
1 2
2 1
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
--
应该是可以用Recursive解决的题目
但是我完全没有头绪该如何下手...
有人可以给我一点想法吗??
另外 这个题目给的指令结束是用EOF吗??
因为题目好像没讲...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.91.122
※ 编辑: bztfir 来自: 140.112.91.122 (11/27 20:44)
1F:推 ianlini:是用EOF节数没错 没讲通常就是EOF 请看123篇 11/27 21:59
2F:→ ianlini:单班助教课的上课内容 11/27 22:00
3F:推 felixgwu:可以参考一下我之前贴出来的47题程式码,原理差不多 11/27 22:21