汉诺塔(推荐)
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目背景
小明最近喜欢上了一个叫做"汉诺塔"的玩具,但是当老师叫小明来完成任务时,小明却在这时不知道该怎么回答老师了。
题目描述
接下来你要帮助小明完成任务。 游戏规则:
输入
输入一个整数。
输出
输出个圆圈所需的所有步骤,格式请看样例。
样例1
3
1.Move 1 from a to c
2.Move 2 from a to b
3.Move 1 from c to b
4.Move 3 from a to c
5.Move 1 from b to a
6.Move 2 from b to c
7.Move 1 from a to c
样例2
4
1.Move 1 from a to b
2.Move 2 from a to c
3.Move 1 from b to c
4.Move 3 from a to b
5.Move 1 from c to a
6.Move 2 from c to b
7.Move 1 from a to b
8.Move 4 from a to c
9.Move 1 from b to c
10.Move 2 from b to a
11.Move 1 from c to a
12.Move 3 from b to c
13.Move 1 from a to b
14.Move 2 from a to c
15.Move 1 from b to c
数据范围
小明
- Status
- Done
- Rule
- OI
- Problem
- 13
- Start at
- 2024-6-16 7:00
- End at
- 2025-1-10 15:00
- Duration
- 5000 hour(s)
- Host
- Partic.
- 5