没啥好说的
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define MAX 55
using namespace std;
int t,n;
int main ( )
{
scanf ( "%d" , &t );
while ( t-- )
{
scanf ( "%d" , &n );
int s[MAX];
int cnt = 0;
while ( n )
{
s[cnt++] = n % 2;
n >>= 1 ;
}
int temp = 1;
int ans = 0;
for ( int i = cnt-1 ; i>=0 ; i-- )
{
ans += temp*s[i];
temp <<= 1;
}
printf ( "%d\n" , ans );
}
}