結果
問題 | No.2970 三次関数の絶対値 |
ユーザー |
![]() |
提出日時 | 2024-11-29 22:46:59 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 295 ms / 2,000 ms |
コード長 | 604 bytes |
コンパイル時間 | 2,502 ms |
コンパイル使用メモリ | 244,500 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-29 22:47:18 |
合計ジャッジ時間 | 17,670 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template <class T> using V=vector<T>; template <class T> using VV=V<V<T>>; const int MAX=1e8; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int c0,c1,c2,c3,l,r; cin>>c0>>c1>>c2>>c3>>l>>r; auto f=[&](double x)->double{ return c0+c1*x+c2*x*x+c3*x*x*x; }; double ans=1e18; double d=(r-l)/(double)MAX; rep(i,MAX+1){ double x=l+d*i; ans=min(ans,abs(f(x))); } printf("%.6f\n",ans); return 0; }