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