406355: GYM102388 A Strange Base

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Strange Basetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

On Planet E, people counts in base $$$\phi$$$!

We are all familiar with decimal representations. In decimal representation, each digit $$$x_i$$$ satisfies $$$0 \le x_i \le 9$$$ and $$$\overline{x_q x_{q - 1} x_{q - 2} \ldots x_0 . x_{-1} x_{-2} \ldots x_p}$$$ represents $$$$$$ \sum_{i = p}^q x_i 10^i = x_q 10^q + x_{q - 1} 10^{q - 1} + \ldots + x_p 10^p. $$$$$$

This can be naturally extended to any integer base $$$b \ge 2$$$. In base $$$b$$$, each digit $$$x_i$$$ satisfies $$$0 \le x_i \le b - 1$$$ and $$$\overline{x_q x_{q - 1} x_{q - 2} \ldots x_0 . x_{-1} x_{-2} \ldots x_p}$$$ represents $$$$$$ \sum_{i = p}^q x_i b^i = x_q b^q + x_{q - 1} b^{q - 1} + \ldots + x_p b^p. $$$$$$

Now it comes to non-integral bases! Let $$$\phi = (1 + \sqrt 5) / 2$$$ be the golden ratio. It can be shown that every positive integer $$$n$$$ can be represented in $$$$$$ n = \sum_{i = p}^q x_i \phi^i = x_q \phi^q + x_{q - 1} \phi^{q - 1} + \ldots + x_p \phi^p, $$$$$$ where each digit $$$x_i$$$ is either $$$0$$$ or $$$1$$$, and any adjacent digits $$$x_i$$$ and $$$x_{i + 1}$$$ are not both $$$1$$$. This representation is unique and is called the base $$$\phi$$$ representation.

Can you help the people on Planet E to convert a positive number in base $$$\phi$$$?

Input

The first line contains a positive integer $$$T$$$ ($$$T \le 10$$$), the number of testcases.

Each testcase contains a positive integer $$$n$$$ ($$$n \le 100000$$$).

Output

For each testcase, output a single line consisting of the representation of $$$n$$$ in base $$$\phi$$$.

ExampleInput
5
1
2
3
100000
123
Output
1
10.01
100.01
101010001010100000100000.101000101000000010000001
10000000000.0000000001

加入题单

上一题 下一题 算法标签: