Advertisement
erfanul007

UVa 679

Apr 29th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5.  
  6. int main()
  7. {
  8. int t,z;
  9. cin>>t;
  10. while(t--){
  11. ll d,l,x=1;
  12. cin>>d>>l;
  13. for(int i=1;i<d;i++){
  14. if(l%2){
  15. x = x*2;
  16. l = (l+1)/2;
  17. }
  18. else{
  19. x = (x*2) + 1;
  20. l/=2;
  21. }
  22. }
  23. cout<<x<<endl;
  24. }
  25. cin>>z;
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement