#K51027. IP Address Binary Converter

    ID: 28996 Type: Default 1000ms 256MiB

IP Address Binary Converter

IP Address Binary Converter

In this problem, you are required to convert a given IPv4 address from dotted-decimal notation into its 32-bit binary representation. Each octet (8-bit segment) must be formatted as an 8-digit binary number (padded with leading zeros if necessary) and the segments must be separated by a single space.

Recall that the binary representation for any decimal number (d) can be obtained using the formula: $$d = \sum_{i=0}^{n-1} b_i \times 2^i$$ where (b_i) are the bits of the number.

inputFormat

The input starts with an integer (T) representing the number of IP addresses. This is followed by (T) lines, each containing a single IPv4 address in dotted-decimal notation.

outputFormat

For each given IP address, output its 32-bit binary representation. Ensure that each octet is printed as an 8-bit binary number with leading zeros and that adjacent octets are separated by a single space. Each result should be printed on a new line.## sample

3
192.168.1.1
10.0.0.1
255.255.255.0
11000000 10101000 00000001 00000001

00001010 00000000 00000000 00000001 11111111 11111111 11111111 00000000

</p>