結果
| 問題 | No.265 数学のテスト |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-22 03:36:48 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 392 ms / 2,000 ms |
| + 938µs | |
| コード長 | 931 bytes |
| 記録 | |
| コンパイル時間 | 51 ms |
| コンパイル使用メモリ | 14,848 KB |
| 実行使用メモリ | 34,560 KB |
| 最終ジャッジ日時 | 2026-10-17 10:09:28 |
| 合計ジャッジ時間 | 16,571 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 34 |
ソースコード
#!/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)
maspy