結果

問題 No.40 多項式の割り算
ユーザー yoza
提出日時 2014-11-24 02:24:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 376 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2025-01-02 21:07:00
合計ジャッジ時間 2,335 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as it

d = int(input())
a_list = list(map(int, input().split()))
a_list.reverse()

for i in range(len(a_list) - 3):
    a_list[i+2] += a_list[i]

result = list(it.dropwhile(lambda x: x == 0, a_list[-3:]))

result.reverse()
if len(result) == 0:
    print(0)
    print(0)
else:
    print(len(result) - 1)
    print(" ".join(map(str, result)))
0