結果

問題 No.40 多項式の割り算
コンテスト
ユーザー gorugo30
提出日時 2021-02-25 22:10:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 437 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 318 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 61,440 KB
最終ジャッジ日時 2026-04-17 14:48:31
合計ジャッジ時間 2,659 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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