| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 525 人关注过本帖
标题:C++的【算法】
只看楼主 加入收藏
ronaldowsy
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2008-10-20
收藏
 问题点数:0 回复次数:0 
C++的【算法】
【算法】:Horner scheme

[localimg=362,20]1[/localimg]

Description

In numerical analysis, the Horner scheme or Horner algorithm, named after William George Horner, is an algorithm for the efficient evaluation of polynomials in monomial form. Horner's method describes a manual process by which one may approximate the roots of a polynomial equation. The Horner scheme can also be viewed as a fast algorithm for dividing a polynomial by a linear polynomial with Ruffini's rule.

 
图片附件: 游客没有浏览图片的权限,请 登录注册

=
图片附件: 游客没有浏览图片的权限,请 登录注册


Application

The Horner scheme is often used to convert between different positional numeral systems — in which case x is the base of the number system, and the ai coefficients are the digits of the base-x representation of a given number — and can also be used if x is a matrix, in which case the gain in computational efficiency is even greater.

History

Even though the algorithm is named after William George Horner, who described it in 1819, the method was already known to Isaac Newton in 1669, and even earlier to the Chinese mathematician Ch'in Chiu-Shao in the 13th century.

TASK: write a program to calculate sum of Polynomial by Horner scheme.

Input

tow lines.
The first line have tow numbers,n and x, n<=20, x<=10
The second line have n+1 numbers, a0,a1...an.

Output

The sum of Polynomial

Sample Input


5 2
0 1 2 3 4 5

Sample Output


258
搜索更多相关主题的帖子: 算法 
2008-10-25 17:19
快速回复:C++的【算法】
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027149 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved