~cpp #include <iostream> using namespace std; int Mcount = 0; //횟 한 int hanoi(int disk,int start, int other, int finish){ Mcount++; //함 호 1 // 크 1 start finish if(disk == 1) cout << start << " " << finish << endl; // 크 1 else { hanoi(disk-1,start,finish,other); // 큰 other 함 호 cout << start << " " << finish << endl; hanoi(disk-1,other,start,finish); // other finish 함 호 } return Mcount; } void main(){ int disk,MoveCount; cout << "크 : "; cin >> disk; MoveCount = hanoi(disk,1,2,3); cout << endl << " 횟" << MoveCount << endl; }