eolymp
bolt
Try our new interface for solving problems
Problems

Binary Numbers

Binary Numbers

Given a positive integer \textbf{n}, print out the positions of all \textbf{1}'s in its binary representation. The position of the least significant bit is \textbf{0}. The positions of \textbf{1}'s in the binary representation of \textbf{13} are \textbf{0}, \textbf{2}, \textbf{3}. Write a program which for each data set: \begin{itemize} \item reads a positive integer \textbf{n}, \item computes the positions of \textbf{1}'s in the binary representation of \textbf{n}, \item writes the result. \end{itemize} \InputFile The first line of the input contains exactly one positive integer \textbf{d} equal to the number of data sets, \textbf{1} ≤ \textbf{d} ≤ \textbf{10}. The data sets follow. Each data set consists of exactly one line containing exactly one integer \textbf{n}, \textbf{0} ≤ \textbf{n} ≤ \textbf{10^6}. \OutputFile The output should consists of exactly \textbf{d} lines, one line for each data set. Line \textbf{i}, \textbf{1} ≤ \textbf{i} ≤ \textbf{d}, should contain increasing sequence of integers separated by single spaces - the positions of \textbf{1}'s in the binary representation of the \textbf{i}-th input number.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1
13
Output example #1
0 2 3
Source II этап Всеукраинской олимпиады школьников 2012-2013, г. Бердичев