#!/usr/local/bin/tcc -run #include void hanoi(int n, char *from, char *to, char *via) { if (n == 1) { printf("%s -> %s\n", from, to); } else { hanoi(n - 1, from, via, to); printf("%s -> %s\n", from, to); hanoi(n - 1, via, to, from); } } int main(void) { printf("--- 8枚 ---\n"); hanoi(8, "A", "B", "C"); return 0; }