Advertisement
achulkov2

Untitled

Feb 24th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void move(int n, int x, int y){
  5.  
  6. if(n>0){
  7. int t=6-x-y;
  8. move(n-1, x, y);
  9. cout<<n<<" "<<x<<" "<<t<<"\n";
  10. move(n-1, y, x);
  11. cout<<n<<" "<<t<<" "<<y<<"\n";
  12. move(n-1,x,y);
  13. }
  14.  
  15. return;
  16. }
  17. int main(){
  18. int a;
  19. cin>>a;
  20. move(a,1,3);
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement