UVA-948 - Fibonaccimal Base

  • UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt
  • 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
  • 本題選為「20160524 大學程式能力檢定 CPE」題目。
  • 相同題目:ZOJ-a134

題意概要

題目給定一個以十進位為基底的數值,試求:該數值以費式數列 (Fibonacci Series) 為基底的表示式。


Input

The first line of input contains a single number , representing the quantity of numbers that follow (). Than follow exactly lines, each one containing a single positive integer smaller than . These numbers can come in any order.


Output

You should output a single line for each of the integers in the input, with the format DEC_BASE = FIB_BASE (fib). DEC_BASE is the original number in decimal base and FIB_BASE is its representation in Fibonaccimal base. See the sample output for an example.


Sample Input

10
1
2
3
4
5
6
7
8
9
10

Sample Output

1 = 1 (fib)
2 = 10 (fib)
3 = 100 (fib)
4 = 101 (fib)
5 = 1000 (fib)
6 = 1001 (fib)
7 = 1010 (fib)
8 = 10000 (fib)
9 = 10001 (fib)
10 = 10010 (fib)
profile-image
David Lu
Hello, I'm David Lu. I am a graduate student in Department of Computer Science at National Chiao Tung University, Taiwan. I am in the Networking and Sensing Systems (NSS) Lab at NCTU. If you have any question, please feel free to contact with me.
comments powered by Disqus