結果

問題 No.40 多項式の割り算
ユーザー cherrypi59
提出日時 2018-10-02 07:25:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 408 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-10-12 09:59:57
合計ジャッジ時間 2,465 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    d = int(input())
    a = list(map(int, input().split()))

    a.reverse()
    for i in range(d-2):
        a[i+2] += a[i]
        a[i] = 0

    i = 0
    while i <= d and not a[i]:
        i += 1

    if i == d + 1:
        print("0\n0")
    else:
        print(d-i)
        for j in range(d, i-1, -1):
            print(a[j], end=" ")
        print()


if __name__ == '__main__':
    main()
0