#C8024. Reversed Binary Encoding

    ID: 51961 Type: Default 1000ms 256MiB

Reversed Binary Encoding

Reversed Binary Encoding

You are given an integer \( n \). Your task is to encode \( n \) by performing the following steps:

  • Convert \( n \) into its binary representation \( b \) (without the prefix 0b).
  • Reverse the binary string \( b \) to get \( r \).
  • Convert the reversed string \( r \) back to a decimal integer.

For example, for \( n=13 \), its binary representation is 1101, which reversed becomes 1011, and converting 1011 from binary to decimal gives \( 11 \).

The task is to process multiple test cases.

inputFormat

The first line of input contains an integer \( T \), the number of test cases.

Each of the following \( T \) lines contains one integer \( n \) (\( 0 \leq n \leq 10^6 \)).

outputFormat

For each test case, output the encoded number on a new line.

## sample
3
13
47
0
11

61 0

</p>