No.40 Polynomial Division
レベル :
/ AI推定難易度 : 600
/ 実行時間制限 : 1ケース 5.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 325
作問者 :
kroton
タグ : / 解いたユーザー数 325
作問者 :
問題文最終更新日: 2020-03-18 00:09:26
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 38
(順位表)
の他の問題:
Problem Statement
One day, your homework included a problem on polynomial division.
However, you are very bad at polynomial division.
So you decided to write a program and have a computer do the calculation for you.
Output the remainder when the given polynomial is divided by \(x^3-x\).
Input
\(D\)
\(a_{0}\) \(a_{1}\) \(\ldots\) \(a_{D}\)
- \(0 \leq D \leq 10000\) represents the degree of the dividend polynomial.
- \(-100 \leq a_{i} \leq 100\) represents the integer coefficients of the dividend polynomial.
- The dividend polynomial is expressed as \(a_{D}x^D + a_{D-1}x^{D-1} + \ldots + a_{2}x^2 + a_{1}x + a_{0}\).
- If \(D \ge 1\), it is guaranteed that \(a_{D} \neq 0\).
Output
Output the remainder when the given polynomial is divided by \(x^3-x\).
Output Format
\(D'\)
\(b_{0}\) \(b_{1}\) \(\ldots\) \(b_{D'}\)
- \(D'\) represents the degree of the remainder polynomial.
- \(b_{i}\) represents the coefficients of the remainder polynomial.
- The remainder polynomial is expressed as \(b_{D'}x^{D'} + b_{D'-1}x^{D'-1} + \ldots + b_{2}x^2 + b_{1}x + b_{0}\).
- If \(D' \ge 1\), it must hold that \(b_{D'} \neq 0\).
0, then although it is not a polynomial of degree 0, treat it here as \(D'=0\).
Sample
Sample 1
Sample 2
Input
8 0 -5 0 4 0 1 -1 0 1
Output
0 0
Although it is not a polynomial of degree 0, take 0 as the answer here.
Sample 3
Input
5 -5 0 -1 1 1 1
Output
1 -5 2
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。