結果

問題 No.40 多項式の割り算
ユーザー cologne
提出日時 2022-01-23 19:30:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 61,312 KB
最終ジャッジ日時 2024-11-30 00:13:46
合計ジャッジ時間 2,878 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


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

    while len(a) > 1:
        if a[-1] == 0:
            a.pop()
        elif len(a) >= 4:
            a[-3] += a[-1]
            a.pop()
        else:
            break

    print(len(a)-1)
    print(*a, sep=' ')


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