結果

問題 No.40 多項式の割り算
ユーザー gorugo30
提出日時 2021-02-25 22:10:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 5,000 ms
コード長 437 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 61,568 KB
最終ジャッジ日時 2024-10-01 13:15:40
合計ジャッジ時間 3,060 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

D = int(input())
A = list(map(int, input().split()))
def f(x):
    ans = 0
    x0 = x
    x = 1
    for i in range(D + 1):
        ans += A[i] * x
        x *= x0
    return ans
# a - b + c = f(-1)
# c = f(0)
# a + b + c = f(1)
c = f(0)
a = (f(-1) + f(1) - 2 * c) // 2
b = (f(1) - f(-1)) // 2
if a == 0:
    if b == 0:
        print(0)
        print(c)
    else:
        print(1)
        print(c, b)
else:
    print(2)
    print(c, b, a)
0