結果

問題 No.40 多項式の割り算
ユーザー ABKZ
提出日時 2021-12-25 21:07:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 92 ms / 5,000 ms
コード長 273 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 60,928 KB
最終ジャッジ日時 2024-09-22 02:18:10
合計ジャッジ時間 2,896 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

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

while len(a) > 3:
    tail = a.pop(-1)
    a[-2] += tail
    while len(a) > 0 and a[-1] == 0:
        a.pop(-1)
    
if len(a) == 0:
    print("0")
    print("0")
else:
    print(len(a) - 1)
    print(" ".join(map(str, a)))
0