GO Solution For UVa 10719 - Quotient Polynomial. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

A polynomial of degree n can be expressed as

p(x) = anx n + an−1x

n−1 + · · ·+ a1x+ a0 If k is any integer then we can write:

p(x) = (x− k)q(x) + r

Here q(x) is called the quotient polynomial of p(x) of degree (n − 1) and r is any integer which is called the remainder.

For example, if p(x) = x3

...

You can find the full details of the problem Quotient Polynomial at UVa Online Judge

Sample Input

3
1 -7 15 -8
3
1 -7 15 -9

Sample Output

q(x): 1 -4 3
r = 1

q(x): 1 -4 3
r = 0

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985