亮片数字
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 262144K,其他语言524288K
64 位 IO 格式: %lld
空间限制:C/C++ 262144K,其他语言524288K
64 位 IO 格式: %lld
题目描述
亮片数字是数字序列:
d_n d_{n-1}\cdots d_1 d_0dndn−1⋯d1d0
哪里d_ndn是11或22而其他的都是0,10,1或22.
它表示有理数:d_0 + d1 *( 3/2) + d_2 *( 3/2)^ 2 + ... + d_n*( 3/2)^ nd0+d1∗(3/1)+d2∗(3/1)2+。。。+dn∗(3/1)n
编写一个程序,该程序将亮片数字作为输入,并返回它表示为适当分数的数字。
输入描述:
The single line of input contains a sequinary numeral of no more than 3232 digits.
输出描述:
Output consists of a single line.
If the result is an integer, the output is the decimal integer. Otherwise, the output is NN a single space and K/MK/M where NN, KK and MM are decimal integers where K < MK<M and K/MK/M is in lowest terms (GCD(K, M)= 1GCD(K,M)=1).