题目描述 https://vjudge.net/problem/UVA-679
仔细观察规律模拟处理即可
代码如下:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a,l;
while (cin >> n && n >= 0) {
while (n --) {
cin >> l >> a;
int t = 1;
while (-- l) {
if (a%2) t = t<<1;
else t = (t<<1)+1;
a = (a+1)>>1;
}
cout << t << endl;
}
}
return 0;
}