#include <iostream> using namespace std; struct TreeNode{ int val; TreeNode *left; TreeNode *right; TreeNode(int x):val(x),left(nullptr),right(nullptr){} }; int thecommonparent(int &x,int &y){ if(x==y){ return x; } while(x!=y){ if(x<y){ if(y%2==0){ y/=2; } else{ y=(y-1)/2; } } else{ if(x%2==0){ x/=2; } else{ x=(x-1)/2; } } } return x; } int main() { int x, y; while (cin >> x >> y) { // 注意 while 处理多个 case cout<<thecommonparent(x,y)<<endl; } return 0; } // 64 位输出请用 printf("%lld")