#include <stdio.h>
int count = 0;
void hanoi(int n, char from, char temp, char to) {
    if (n == 1) {
        printf("将圆盘 %d 从 %c 移动到 %c\n", n, from, to);
        count++;
        return;
    }
    hanoi(n - 1, from, to, temp);
    printf("将圆盘 %d 从 %c 移动到 %c\n", n, from, to);
    count++;
    hanoi(n - 1, temp, from, to);
}
int main() {
    int n;
    printf("请输入汉诺塔的圆盘数量：");
    scanf("%d", &n);
    hanoi(n, 'A', 'B', 'C');
    printf("总共移动了%d次",count);
           return 0;
}
