Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- int main()
- {
- int t,z;
- cin>>t;
- while(t--){
- ll d,l,x=1;
- cin>>d>>l;
- for(int i=1;i<d;i++){
- if(l%2){
- x = x*2;
- l = (l+1)/2;
- }
- else{
- x = (x*2) + 1;
- l/=2;
- }
- }
- cout<<x<<endl;
- }
- cin>>z;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement