[백준 11729] 하노이 탑 이동 순서
"하노이의 탑"의 기본을 알고 있다면, 카운트 수 및 탑을 움직이는 방법의 저장방법만 고민하면 풀 수 있는 문제였다. 나는 움직이는 방법 저장을 위해 deque를 사용했다. #include #include using namespace std; struct xy{ int x, y; }; deque move_save; int move_count = 0; void Hanoi(int n, int from, int by, int to){ if(n == 1){ move_save.push_back({from, to}); move_count++; } else{ Hanoi(n - 1, from, to, by); move_save.push_back({from, to}); move_count++; Hanoi(n - 1, b..
2020. 1. 13.