11185 - Ternary

You will be given a decimal number. You will have to convert it to its ternary (Base 3) equivalent.

Input

The input file contains at most 100 lines of inputs. Each line contains a non-negative decimal integer N(N<1000000001). Input is terminated by a line containing a negative value. This line should not be processed.

 

Output

For each line of input produce one line of output. This line contains the ternary equivalent of decimal value N.

 

Sample Input                               Output for Sample Input

10
100
1000
-1
101
10201
1101001

 解题思路:给你十进位的数字N,请你把他转换成3 进位。要考虑n=0的情况

posted on 2013-02-07 11:32  喂喂还债啦  阅读(222)  评论(0编辑  收藏  举报