[백준 11729번] c언어 :: 하노이탑 이동 순서
#include #include void hanoi(int n, int from, int by, int to) { if (n == 1) printf("%d %d\n", from, to); else { hanoi(n - 1, from, to, by); printf("%d %d\n", from, to); hanoi(n - 1, by, from, to); } } int main() { int N; int K, A, B; scanf("%d", &N); K = pow(2, N) - 1; printf("%d\n", K); hanoi(N, 1, 2, 3); return 0; } 갯수 할 때 count 로만 할 생각 말고 math 함수 써서 계산할 줄도 !