結果

問題 No.2970 三次関数の絶対値
ユーザー vwxyz
提出日時 2024-11-29 21:32:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 383 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-29 21:32:38
合計ジャッジ時間 2,751 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,c,d=map(int,input().split())
L,R=map(int,input().split())
def f(x):
    return abs(a+b*x+c*x*x+d*x*x*x)
ans=min(f(L),f(R))
if d:
    if c*c-3*b*d>=0:
        D=c*c-3*b*d
        for i in ((-c+D**.5)/(3*d),(-c-D**.5)/(3*d)):
            if L<=i<=R:
                ans=min(ans,f(i))
else:
    if c:
        i=(-b)/(2*c)
        if L<=i<=R:
            ans=min(ans,f(i))
print(ans)
0