結果
| 問題 |
No.2970 三次関数の絶対値
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-11-29 21:47:13 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 544 bytes |
| コンパイル時間 | 240 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-29 21:47:16 |
| 合計ジャッジ時間 | 3,006 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
a,b,c,d=map(int,input().split())
L,R=map(int,input().split())
def f(x):
return a+b*x+c*x*x+d*x*x*x
mi=min(f(L),f(R))
ma=max(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:
mi=min(mi,f(i))
ma=max(ma,f(i))
else:
if c:
i=(-b)/(2*c)
if L-eps<=i<=R+eps:
mi=min(mi,f(i))
ma=max(ma,f(i))
if mi<eps and -eps<ma:
ans=0
else:
ans=min(abs(mi),abs(ma))
print(ans)
vwxyz