結果

問題 No.40 多項式の割り算
コンテスト
ユーザー shin
提出日時 2022-10-16 20:40:17
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 96 ms / 5,000 ms
+ 12µs
コード長 418 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 288 ms
コンパイル使用メモリ 21,408 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2026-07-31 05:39:46
合計ジャッジ時間 5,550 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#多項式の割り算

D = int(input())
a = list(map(int , input().split()))

ans = 0
ans_text = str(a[0])
if D < 3:
    ans = D
else:
    for i in range(D , 2 , -1):
        a[i - 2] += a[i]
        a[i] = 0
    ans = 2
    for j in range(2 , 0 , -1):
        if a[j] == 0:
            ans -= 1
        else:
            break

for k in range(1 , ans + 1):
    ans_text += " " + str(a[k])

print(ans)
print(ans_text)
0