結果

問題 No.40 多項式の割り算
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-04-26 19:18:36
言語 Python2
(2.7.18)
結果
AC  
実行時間 356 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 6,720 KB
最終ジャッジ日時 2023-09-18 11:49:36
合計ジャッジ時間 4,799 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,952 KB
testcase_01 AC 12 ms
5,972 KB
testcase_02 AC 12 ms
5,980 KB
testcase_03 AC 12 ms
6,140 KB
testcase_04 AC 122 ms
6,344 KB
testcase_05 AC 190 ms
6,600 KB
testcase_06 AC 317 ms
6,532 KB
testcase_07 AC 351 ms
6,720 KB
testcase_08 AC 12 ms
6,116 KB
testcase_09 AC 162 ms
6,392 KB
testcase_10 AC 287 ms
6,456 KB
testcase_11 AC 102 ms
6,496 KB
testcase_12 AC 47 ms
6,188 KB
testcase_13 AC 278 ms
6,652 KB
testcase_14 AC 118 ms
6,264 KB
testcase_15 AC 117 ms
6,264 KB
testcase_16 AC 281 ms
6,568 KB
testcase_17 AC 31 ms
6,364 KB
testcase_18 AC 254 ms
6,488 KB
testcase_19 AC 356 ms
6,492 KB
testcase_20 AC 81 ms
6,300 KB
testcase_21 AC 25 ms
6,240 KB
testcase_22 AC 21 ms
6,084 KB
testcase_23 AC 77 ms
6,460 KB
testcase_24 AC 185 ms
6,416 KB
testcase_25 AC 11 ms
6,152 KB
testcase_26 AC 11 ms
5,948 KB
testcase_27 AC 11 ms
6,156 KB
testcase_28 AC 11 ms
6,156 KB
testcase_29 AC 11 ms
5,984 KB
testcase_30 AC 11 ms
6,204 KB
testcase_31 AC 11 ms
6,028 KB
testcase_32 AC 10 ms
6,068 KB
testcase_33 AC 11 ms
6,144 KB
testcase_34 AC 11 ms
5,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from itertools import dropwhile
rstrip = lambda arr, p: list(reversed(list(dropwhile(lambda x: x == p, reversed(arr)))))

d = int(raw_input())
a = map(int, raw_input().split())
z = d
while z > 2:
    a[z-2] += a[z]
    for i in reversed(range(3, z)):
        if a[i] != 0:
            z = i
            break
    else:
        break
res = rstrip(a[:3], 0)
print max(0, len(res) - 1)
print ' '.join(map(str, res)) or 0
0