Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void move(int n, int x, int y) {
- if (n < 1) return;
- else {
- move(n - 1, x, y);
- cout << n << " " << x << " " << 2 << "\n";
- move(n - 1, y, x);
- cout << n << " " << 2 << " " << y << "\n";
- move(n - 1, x, y);
- }
- }
- int main() {
- int n;
- cin >> n;
- move(n, 1, 3);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement