結果

問題 No.40 多項式の割り算
ユーザー ああいい
提出日時 2022-04-21 14:52:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 333 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,792 KB
実行使用メモリ 61,184 KB
最終ジャッジ日時 2024-06-22 18:48:03
合計ジャッジ時間 3,009 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import sys
if D == 0:
    print(0)
    print(a[0])
    exit()
for i in range(3,D+1):
    if i % 2 == 1:
        a[1] += a[i]
    else:
        a[2] += a[i]
a = a[:3]
while a and a[-1] == 0:
    a.pop()
if not a:
    print(0)
    print(0)
else:
    print(len(a) - 1)
    print(*a)
0