当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2809:It's My Derivative

题目描述
As an unnamed space agency endured the ridicule following their now-infamous metric/English unit conversion, they made a vow to never let that error happen again. Unfortunately, they over-hired poor college students with excellent metric/English unit conversion skills but not calculus skills. In fact, nobody at this agency can now remember how to calculate the derivative of a polynomial, let alone evaluate the derivative of a polynomial for a given value of x.

As any good government agency would do in this case, they've decided to outsource the task...to you. And not only do they want you to do the work, they want you to show how you did each step of your calculation so that they might re-learn the skill.

输入解释
Input to this problem will begin with a line containing a single integer n indicating the number of input polynomials. Each of the following n lines contain:
  1. a value of x at which the first derivative of the polynomial is to be evaluated;
  2. and the polynomial.
All polynomials are expressed in terms of x, with single-digit integer coefficients (positive or negative) and non-negative single-digit integer powers of x. Polynomials do not contain spaces. Coefficients and powers of 1 (and powers of 0) are omitted from the notation, as is any "+" sign that might apply to the leading term. The leading term has the highest order, and is followed by the one (if any) with the next-highest order and so on.

输出解释
For each polynomial in the input, output the following lines:
  1. The string "POLYNOMIAL N" where N is 1 for the first polynomial, 2 for the second, etc.;
  2. The polynomial, exactly as in the input;
  3. The first derivative of the polynomial from line 2;
  4. The polynomial in line 3 with x replaced by its value in parenthesis (e.g., if x is 6, "2x^3" becomes "2(6)^3");
  5. The polynomial in step 4 with each term fully evaluated;
  6. and the resulting integer, which is equivalent to f'(x) evaluated at the given value of x.

输入样例
3
5 2x^7+x^2+3x-9
0 -5x^7+x^3+1
-3 5

输出样例
POLYNOMIAL 1
2x^7+x^2+3x-9
14x^6+2x+3
14(5)^6+2(5)+3
218750+10+3
218763
POLYNOMIAL 2
-5x^7+x^3+1
-35x^6+3x^2
-35(0)^6+3(0)^2
0+0
0
POLYNOMIAL 3
5
0
0
0
0

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 South Central USA 2005

源链接: POJ-2809

最后修改于 2020-10-29T06:44:53+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536