Advertisement
achulkov2

Untitled

Feb 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void move(int a,int c,int n){
  4. if(n<1) return;
  5. int b=6-a-c;
  6. move(a,b,n-1);
  7. cout<<n<<" "<<a<<" "<<c<<endl;
  8. move (b,c,n-1);
  9. }
  10. int main(){
  11. int a,b,c,n;
  12. cin>>n;
  13. move(1,3,n);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement