#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
int T;
int depth, num;
scanf("%d" ,&T);
while (T-- > 0)
{
scanf("%d%d", &depth, &num);
int flag = 1 << (depth-1);
int pos = 1;
while (pos < flag)
{
pos = (num&1) ? (pos<<1) : ((pos<<1) + 1);
num = (num&1) ? ((num+1)>>1) : (num>>1);
}
printf("%d\n", pos);
}
int x;
scanf("%d", &x);
return 0;
}
ACM篇:Uva 679 -- Droping Balls
最新推荐文章于 2021-12-02 14:15:54 发布