#K11781. Binary Incremental Sequence Generator

    ID: 23545 Type: Default 1000ms 256MiB

Binary Incremental Sequence Generator

Binary Incremental Sequence Generator

You are given a positive integer n. Your task is to generate the Binary Incremental Sequence (BIS) for n, which consists of the binary representations of all integers from 0 to n-1 without leading zeroes.

More formally, for a given positive integer n, you need to output the sequence:

$$[bin(0),\;bin(1),\;\dots,\;bin(n-1)]$$

Here, \(bin(x)\) denotes the binary representation of \(x\) (without any extra leading zeros). For each test case, print the numbers separated by a space.

inputFormat

The input is given through stdin and has the following format:

T
n1
n2
…
nT

Where:

  • T is the number of test cases.
  • Each of the following T lines contains a single integer n (\(n \ge 0\)).

outputFormat

For each test case, output a single line on stdout containing the binary representations of all integers from 0 to n-1, separated by a space.

If n = 0, output an empty line.

## sample
3
3
5
2
0 1 10

0 1 10 11 100 0 1

</p>