結果

問題 No.265 数学のテスト
ユーザー maspymaspy
提出日時 2020-03-22 03:36:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 931 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 30,736 KB
最終ジャッジ日時 2023-08-25 23:26:12
合計ジャッジ時間 8,043 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
30,736 KB
testcase_01 AC 139 ms
30,416 KB
testcase_02 AC 284 ms
29,768 KB
testcase_03 AC 156 ms
29,884 KB
testcase_04 AC 201 ms
29,896 KB
testcase_05 AC 255 ms
29,912 KB
testcase_06 AC 165 ms
29,900 KB
testcase_07 AC 184 ms
29,776 KB
testcase_08 AC 276 ms
29,992 KB
testcase_09 AC 197 ms
29,856 KB
testcase_10 AC 238 ms
29,876 KB
testcase_11 AC 221 ms
29,960 KB
testcase_12 AC 127 ms
29,416 KB
testcase_13 AC 130 ms
29,764 KB
testcase_14 AC 130 ms
29,516 KB
testcase_15 AC 128 ms
29,492 KB
testcase_16 AC 140 ms
29,568 KB
testcase_17 AC 130 ms
29,544 KB
testcase_18 AC 128 ms
29,452 KB
testcase_19 AC 129 ms
29,456 KB
testcase_20 AC 129 ms
29,456 KB
testcase_21 AC 129 ms
29,456 KB
testcase_22 AC 144 ms
29,484 KB
testcase_23 AC 129 ms
29,472 KB
testcase_24 AC 130 ms
29,552 KB
testcase_25 AC 148 ms
29,668 KB
testcase_26 AC 130 ms
29,544 KB
testcase_27 AC 130 ms
29,328 KB
testcase_28 AC 131 ms
29,432 KB
testcase_29 AC 128 ms
29,360 KB
testcase_30 AC 129 ms
29,432 KB
testcase_31 AC 128 ms
29,320 KB
testcase_32 AC 128 ms
29,448 KB
testcase_33 AC 130 ms
29,380 KB
testcase_34 AC 129 ms
29,408 KB
testcase_35 AC 130 ms
29,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


N = int(readline())
D = int(readline())
S = read().rstrip().decode()

import numpy as np


def der(f):
    g = np.zeros_like(f)
    g[:-1] = f[1:] * np.arange(1, len(f))
    return g


S = S.replace('d{', ' d{ ').replace('}', ' } ').replace('+', ' + ').split()
depth = 0
answer = np.zeros(D + 1, np.int64)
for word in S:
    if word == '+':
        continue
    if word == 'd{':
        depth += 1
        continue
    if word == '}':
        depth -= 1
        continue
    if depth > D:
        continue
    coef = 1
    deg = 0
    terms = word.split('*')
    for t in terms:
        if t == 'x':
            deg += 1
        else:
            coef = int(t)
    f = np.zeros(D + 1, np.int64)
    f[deg] = coef
    for _ in range(depth):
        f = der(f)
    answer += f

print(*answer)
0