TopCoder

User's AC Ratio

100.0% (30/30)

Submission's AC Ratio

78.7% (37/47)

Tags

Description

你知道什麼是河內塔嗎?如果不知道請參照< TIOJ1355 >。

話說天神最近心情很不好,因為有你的幫忙,使得僧侶們的效率增加,於是天神開始慌張了。

最後天神終於想到了一個好方法:既然僧侶們已經知道目前規則的方法,那只要稍微改變規則就行了阿!

於是天神規定,3號柱子與1號柱子的移動過程之間,一定要先經過2號柱子。

這下僧侶可頭大了,你能再次幫助他嗎?

Input Format

輸入只含有一個數字n(1<=n<=10)代表金屬片的數量

Output Format

請輸出當有n片金屬片的時候要按照怎樣的步驟可以最快從1號柱子搬到3號柱子(格式請參照範例輸出)

Sample Input 1

2

Sample Output 1

#1 : move the dish from #1 to #2
#2 : move the dish from #2 to #3
#3 : move the dish from #1 to #2
#4 : move the dish from #3 to #2
#5 : move the dish from #2 to #1
#6 : move the dish from #2 to #3
#7 : move the dish from #1 to #2
#8 : move the dish from #2 to #3

Hints

※2008/07/10:題目敘述修正 by hallogameboy

Problem Source

原TIOJ1356 / 快樂暑假營第一次練習比賽。Problem Setter:hallogameboy

Subtasks

No. Testdata Range Score
1 0 10
2 1 10
3 2 10
4 3 10
5 4 10
6 5 10
7 6 10
8 7 10
9 8 10
10 9 10

Testdata and Limits

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