Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <queue>
- using namespace std;
- void rec(int N, int first_tower, int second_tower, int third_tower) {
- if(N == 0) {
- return;
- }
- rec(N - 1, first_tower, third_tower, second_tower);
- cout << first_tower << " " << third_tower << endl;
- rec(N - 1, second_tower, first_tower, third_tower);
- }
- int main() {
- int N;
- cin >> N;
- cout << (1 << N) - 1 << endl;
- rec(N, 1, 2, 3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement