Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: The Teacher’s Side of Math
Description One of the tasks students routinely carry out in their mathematics classes is to solve a polynomial equation. It is, given a polynomial, say If the students’ task is to find the roots of a given polynomial, the teacher’s task is then to find a polynomial that has a given root. Ms. Galsone is an enthusiastic mathematics teacher who is bored with finding solutions of quadratic equations that are as simple as You are given a number
where In this problem, you are asked to find a_{d}_{−1}X^{d}^{−1} + ⋯ + a_{1}X + a_{0} satisfying the following conditions.Coefficients *a*_{0}, …,*a*are integers and_{d}*a*> 0._{d}*F*(*t*) = 0.The degree *d*is minimum among polynomials satisfying the above two conditions.*F*(*X*) is*primitive*. That is, coefficients*a*_{0}, …,*a*have no common divisors greater than one._{d}
For example, the minimal polynomial of √3 + √2 on integers is
Verifying that the degree of Input The input consists of multiple datasets, each in the following format.
This line represents Every dataset satisfies the following conditions. ^{m}√*a*+^{n}√*b*≤ 4.*mn*≤ 20.The coefficients of the answer *a*_{0}, …,*a*are between (−2_{d}^{31}+ 1) and (2^{31}− 1), inclusive.
Output For each dataset, output the coefficients of its minimal polynomial on integers a_{d}_{−1}X^{d}^{−1} + ⋯ + a_{1}X + a_{0}, in the following format.
a_{d}_{−1} … a_{1} a_{0}Non-negative integers must be printed without a sign (+ or −). Numbers in a single line must be separated by a single space and no other characters or extra spaces may appear in the output. Sample Input 3 2 2 2 3 2 2 3 2 2 3 4 31 4 2 3 3 2 2 7 0 0 0 0 Sample Output 1 0 -10 0 1 1 0 -9 -4 27 -36 -23 1 0 -8 0 18 0 -104 0 1 1 0 0 -8 -93 0 24 -2976 2883 -32 -3720 -23064 -29775 1 0 -21 0 189 0 -945 -4 2835 -252 -5103 -1260 5103 -756 -2183 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator