A sequinary numeral is a sequence of digits: dndn1d1d0d_n d_{n-1}cdots d_1 d_0dndn1d1d0 where dnd_ndnis 111or 222 and the others are 0,10,10,1, or 222. It represents the rational number:d0+d1(3/2)+d2(3/2)2+...+dn(3/2)nd_0 + d1 * + d_2 *^ 2 + ... + d_n*^ nd0+d1(3/2)+d2(3/2)2+...+dn(3/2)n Write a program which takes a sequinary numeral as input and returns the number it represents as a proper fraction.
A sequinary numeral is a sequence of digits: dndn−1⋯d1d0d_n d_{n-1}cdots d_1 d_0dndn−1⋯d1d0 where dnd_ndn is 111 or 222 and the others are 0,10,10,1, or 222. It represents the rational number: d0+d1∗(3/2)+d2∗(3/2)2+...+dn∗(3/2)nd_0 + d1 *( 3/2) + d_2 *( 3/2)^ 2 + ... + d_n*( 3/2)^ nd0+d1∗(3/2)+d2∗(3/2)2+...+dn∗(3/2)n Write a program which takes a sequinary numeral as input and returns the number it represents as a proper fraction.
(图片来源网络,侵删)