https://www.nowcoder.com/practice/5b80ab166efa4551844657603227caeb?tpId=40&tPage=1&rp=1&ru=%2Fta%2Fkaoyan&qru=%2Fta%2Fkaoyan%2Fquestion-ranking&difficulty=&judgeStatus=&tags=583&title=&sourceUrl=&gioEnter=menu
节点按从1到n顺序排列成完全二叉树
#include <iostream>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) { // 注意 while 处理多个 case
while(a != b)
{
if(a > b) a = a/2;
else b = b/2;
}
cout << a << endl;
}
}