1. 程式人生 > >679 Dropping Balls

679 Dropping Balls

#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; }