//直接輸出n即可
void tower(int n, char a, char b, char c)
{
if (n == 1)
{
printf("Move ring %d from %c to %c\n",n,a,c);
}
else {
tower(n - 1, a,c,b);
printf("Move ring %d from %c to %c\n", n, a, c);
tower(n-1, b, a, c);
}
}