Advertisement
Ankit_132

D

Jan 24th, 2024
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int t;
  6.     cin>>t;
  7.    
  8.     while(t--){
  9.         int x;
  10.         cin>>x;
  11.        
  12.         int ans = 1;
  13.         int f = 0;
  14.        
  15.         for(int b=30; b>=0; b--){
  16.             if(((1<<b)&x) > 0){
  17.                 f++;
  18.             }
  19.             else if(f >= 2)
  20.                 ans *= 2;
  21.         }
  22.        
  23.         cout<<ans<<"\n";
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement