
73  ZOJ Monthly, December 2008  A
Bernstein polynomial is defined as where , and: A polynomial can be represent in format d c_{d} c_{d1} ... c_{1} c_{0} where c_{d} can be zero only if d is zero. Given a polynomial and n, your task is to calculate the corresponding Bernstein polynomial. Input A polynomial in a separate line, satisfying that 0 <= d < 64, all coefficients c_{i} are integers in range [16, 16]. Then an integer 0 < n < 65536 in a separate line. Output The corresponding Bornstein polynomial. The coefficients are in irreducible fraction. See sample for more details. Sample Input
0 1 1 3 1 0 0 0 3 Sample Output
0 1/1 3 2/9 2/3 1/9 0/1 Author: WU, Zejun Source: ZOJ Monthly, December 2008 