QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 256 MB Points totaux : 100 Hackable ✓

#15173. Derivation

Statistiques

Zag 最近正在学习求导。他给你一个多项式,并请你帮他求出它的导数。

正式地,我们假设 $x^i$ 项的系数为 $a$,并规定多项式的正确表示法如下:

    1. 各项的次数为非负整数,且按降序排列。
    1. 如果 $a = 0$,则不写该项;否则,如果 $a = 1$ 且 $i \neq 0$,则不写系数。
    1. 对于 $i = 0$ 的项,表示为 $a$;对于 $i = 1$ 的项,表示为 $ax$;对于其他项,表示为 $ax\text{^}i$。
    1. 如果某项的系数为负,则在其前面加上负号,否则加上正号。注意,对于第一项,如果系数为正,则省略加号。
    1. 特别地,如果多项式为 $f(x) = 0$,则应表示为 $0$。

输入格式

输入包含 f(x)=,后跟一个正确的多项式表达式。

数据保证输入字符串的长度不超过 $10^6$,且输入多项式的系数和次数均不超过 $10^5$。

输出格式

首先输出 f'(x)=,然后输出给定多项式的导数。格式应与上述描述一致。

样例

输入样例 1

f(x)=x^4-3x^2-x+1

输出样例 1

f'(x)=4x^3-6x-1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.