P (x,n) = ((an*x + an-1)*x + an-2)*x + ...
伪代码如下:
input x,n,a1...an
p = an
i = n
while (i > 0)
{
p += p * x + ai-1
i--
}