fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. long x,ans;
  7. cin>>n;
  8. while(n--)
  9. {
  10. cin>>x;
  11. ans=1;
  12. while(x){
  13. ans<<=1;
  14. x&=(x-1);
  15.  
  16. }
  17. cout<<ans<<endl;
  18. }
  19. }
Success #stdin #stdout 0s 15232KB
stdin
3
0
2
1073741823
stdout
1
2
1073741824