教你如何求多项式的系数

这篇博客介绍了如何使用编程方法求解多项式的导数。文章通过一个简单的例子阐述了求导的三个基本规则,并提供了处理包含非负系数的多项式导数的算法。输入包含多组测试案例,每组案例给出多项式的次数和系数,输出相应的导数多项式的系数。样例输入和输出展示了具体的操作过程。
摘要由CSDN通过智能技术生成

在数学书我们曾经学过求多项式系数的问题吧,但是编程上怎么办呢?

先给一道例题看看吧
Easy Task

Calculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))’ to denote its derivation. We use x^n to denote xn. To calculate the derivation of a polynomial, you should know 3 rules:
(1) (C)’=0 where C is a constant.
(2) (Cx^n)’=C*n*x^(n-1) where n>=1 and C is a constant.
(3) (f1(x)+f2(x))’=(f1(x))’+(f2(x))’.
It is easy to prove that the derivation a polynomial is also a polynomial.

Here comes the problem, given a polynomial f(x) with non-negative coefficients, can you write a program to calculate the derivation of it?

Input

Standard input will contain multiple test cases. The first line of the input is a single integerT (1 <= T <= 1000) which is the number of test cases. And it will be followed byT consecutive test cases.

There are exactly 2 lines in each tes

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值