输入数据有多组,每组1个整数n,表示Hanoi塔的阶数。
将每次移动(move)按照以下格式输出:%2d. Move disk %d from %c to %c\n
上述格式中第一个整数表示第几次移动,第二个整数表示移动第几个圆盘,后两个字符表示将圆盘从哪个塔座移至哪个塔座上。每组输出后面输出一个空行。
1 2 3
1. Move disk 1 from X to Z 1. Move disk 1 from X to Y 2. Move disk 2 from X to Z 3. Move disk 1 from Y to Z 1. Move disk 1 from X to Z 2. Move disk 2 from X to Y 3. Move disk 1 from Z to Y 4. Move disk 3 from X to Z 5. Move disk 1 from Y to X 6. Move disk 2 from Y to Z 7. Move disk 1 from X to Z