#P1100. Swap High and Low 16 Bits
Swap High and Low 16 Bits
Swap High and Low 16 Bits
Given a non-negative integer less than $$2^{32}$$, represent it as a 32-bit binary number (padded with leading zeros if necessary). The first 16 bits are called the high bits and the last 16 bits are called the low bits. Your task is to swap these high and low 16-bit parts and output the resulting number in decimal.
For example, consider the integer 1314520
. Its 32-bit binary representation is:
$$000000000000000101000000111011011000$$ (with leading zeros added). The high bits are the first 16 bits and the low bits are the last 16 bits. After swapping these parts, the new binary number becomes:
$$00001110110110000000000000010100$$, which is 249036820
in decimal.
inputFormat
The input consists of a single non-negative integer n
(where $$0 \leq n < 2^{32}$$).
outputFormat
Output a single integer, which is the result obtained by swapping the high 16 bits and the low 16 bits of the 32-bit binary representation of n
.
sample
1314520
249036820