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>0){
- int t=6-x-y;
- move(n-1, x, y);
- cout<<n<<" "<<x<<" "<<t<<"\n";
- move(n-1, y, x);
- cout<<n<<" "<<t<<" "<<y<<"\n";
- move(n-1,x,y);
- }
- return;
- }
- int main(){
- int a;
- cin>>a;
- move(a,1,3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement