Advertisement
Guest User

tree

a guest
Nov 1st, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int a, b, upper[2]={0, 1}, lower[2]={1, 0}, temp[2]={1, 1};
  5.  
  6. void f(bool b)
  7. {
  8.     if(b)
  9.     {
  10.         cout << 'L';
  11.         lower[0] = temp[0];
  12.         lower[1] = temp[1];
  13.         temp[0]+= upper[0];
  14.         temp[1]+= upper[1];
  15.     }
  16.     else
  17.     {
  18.         cout << 'R';
  19.         upper[0] = temp[0];
  20.         upper[1] = temp[1];
  21.         temp[0]+= lower[0];
  22.         temp[1]+= lower[1];
  23.     }
  24. }
  25.  
  26. int main()
  27. {
  28.     cin >> a >> b;
  29.  
  30.     while(temp[0]!=a||temp[1]!=b)
  31.     {
  32.         f(bool(a/b < temp[0]/temp[1]));
  33.     }
  34.  
  35.     cout << endl;
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement