結果

問題 No.40 多項式の割り算
ユーザー szkhts
提出日時 2023-06-11 07:44:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 402 ms / 5,000 ms
コード長 271 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 31,904 KB
最終ジャッジ日時 2025-01-03 03:44:10
合計ジャッジ時間 14,424 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

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

for i in range(D, 2, -1):
    a[i - 2] += a[i]
    a[i] = 0

ans = 0
if len(a) >= 3:
    if a[2]:
        ans = 2
    elif a[1]:
        ans = 1

print(ans)
print(" ".join(map(str, a[0:ans + 1])))
0