結果
問題 |
No.2970 三次関数の絶対値
|
ユーザー |
![]() |
提出日時 | 2024-11-29 21:45:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 544 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-11-29 21:45:24 |
合計ジャッジ時間 | 2,798 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 WA * 15 |
ソースコード
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=min(ma,f(i)) else: if c: i=(-b)/(2*c) if L-eps<=i<=R+eps: mi=min(mi,f(i)) ma=min(ma,f(i)) if mi<eps and -eps<ma: ans=0 else: ans=min(abs(mi),abs(ma)) print(ans)