作者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)
推 ianlini:是用EOF節數沒錯 沒講通常就是EOF 請看123篇 11/27 21:59
→ ianlini:單班助教課的上課內容 11/27 22:00
推 felixgwu:可以參考一下我之前貼出來的47題程式碼,原理差不多 11/27 22:21