[BOJ 15612] Cube Bits
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
1
Time limit:
4.0s
Memory limit:
512M
Problem types
Allowed languages
The new computers are here! However, we made a mistake during the order: we thought we were ordering machines with qubits; in fact, we ordered several hundred computers powered by cube-bits.</p>
The programs and data we had ready were prepared in base 10. To feed the data into the new computer, which uses a cubic system of counting, we will need to convert it to base 3 first.
Write a program to convert a stream of decimal numbers into ternary format, so they fit the new system’s input bus.
입력 형식
The input consists of:</p>
- One line with an integer n (1 ≤ n ≤ 106), the size of the data stream.
- n lines with one decimal integer vi (0 ≤ v < 320), the decimal representation of the i-th integer in the data stream.
Output n lines, giving the numbers converted to base-3, in the same order as given. In the interest of conserving disk space, do not print leading zeroes.
예제 입력 1
4
12
14
13
15
예제 출력 1
110
112
111
120
예제 입력 2
2
2147483648
3486784400
예제 출력 2
12112122212110202102
22222222222222222222
Comments