• [E] Endless Tree

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • There is a endless binary tree, just like the image below. The big boss is in the root, you and your teammate, were transmitted to two nodes -- Nth node and Mth node. In this tree, you can only go up to arrive the root, that means you can't retreat any steps. Now your teammate sent a buff up to root, the buff will go step by step. You want to get that buff to defeat the boss, so you can wait to get this buff, or you can move to catch it, all you should do is to get the buff as quickly as possible, at last, you should tell where you got the buff.


  • 输入
  • For each case, there is two inter N and M, all no more than int.
  • 输出
  • For each case, print number of the node where you got the buff.
  • 样例输入
  • 4 10
    4 9
    
  • 样例输出
  • 2
    4
    
  • 提示
  • 来源
  • 小白菜
  • 操作

显示春菜