結果

問題 No.2970 三次関数の絶対値
ユーザー okaze
提出日時 2025-01-20 00:57:49
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 467 bytes
コンパイル時間 750 ms
コンパイル使用メモリ 82,624 KB
実行使用メモリ 67,280 KB
最終ジャッジ日時 2025-01-20 00:57:54
合計ジャッジ時間 5,549 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

import sympy as sp

C1, C2, C3, C4 = map(int, input().split())
L, R = map(int, input().split())

x = sp.symbols('x')
f = C1 + C2*x + C3*(x**2) + C4*(x**3)

baaiwake = sp.Piecewise(
    (f, f >= 0),
    (-f, f < 0)
)

points = sp.solveset(sp.diff(baaiwake, x), x, domain=sp.Interval(L, R))
check = [L, R] + [pt for pt in points if L <= pt <= R]

ans = None
for pt in check:
    val = baaiwake.subs(x, pt)
    if ans is None or val < ans:
        ans = val

print(ans)
0