結果

問題 No.40 多項式の割り算
ユーザー akanayaakanaya
提出日時 2020-11-23 14:14:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 7,992 KB
最終ジャッジ日時 2023-09-30 23:46:17
合計ジャッジ時間 16,556 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,768 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 OLE -
testcase_05 OLE -
testcase_06 OLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def div(a, b):
    if len(a) < len(b):
        return a
    
    count = len(a) - len(b) + 1
    for i in range(count):
        k = a[i] / b[0]
        for j in range(len(b)):
            a[i + j] = a[i + j] - k * b[j]
        print(a)
            
    rel = 0
    for l in range(len(a)):
        if a[l] != 0:
            rel = l
            break
    return a[l:]

        
d = int(input())
ary = list(map(int, input().split(' ')))

result = div(ary, [1, 0, -1, 0])


print(len(result) - 1)
for i in result:
    print(int(i), end=' ')
print()
0