#include <stdio.h>
void hanoi(int n, char from, char temp, char to) {
    // 终止条件：只有1个圆盘时，直接从源柱移到目标柱
    if (n == 1) {
        printf("将圆盘 %d 从 %c 移动到 %c\n", n, from, to);
        return;
    }
    // 步骤1：将n-1个圆盘从from移到temp（用to作为辅助）
   
    // 步骤2：将第n个圆盘从from移到to
    printf("将圆盘 %d 从 %c 移动到 %c\n", n, from, to);
    // 步骤3：将n-1个圆盘从temp移到to（用from作为辅助）
    
}
int main() {
    int n;
    printf("请输入汉诺塔的圆盘数量：");
    scanf("%d", &n);
    
    hanoi(n, 'A', 'B', 'C');
    return 0;
}