結果
| 問題 | No.2970 三次関数の絶対値 |
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-11-29 21:33:45 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 408 bytes |
| 記録 | |
| コンパイル時間 | 166 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-29 21:33:49 |
| 合計ジャッジ時間 | 2,864 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 WA * 12 |
ソースコード
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))
eps=1e-7
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-eps<=i<=R+eps:
ans=min(ans,f(i))
else:
if c:
i=(-b)/(2*c)
if L-eps<=i<=R+eps:
ans=min(ans,f(i))
print(ans)
vwxyz