結果

問題 No.2970 三次関数の絶対値
ユーザー GOTKAKO
提出日時 2024-11-29 21:27:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 1,970 ms
コンパイル使用メモリ 195,000 KB
最終ジャッジ日時 2025-02-26 09:11:59
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    vector<double> C(4);
    for(auto &c : C) cin >> c;

    double L,R; cin >> L >> R;
    double answer = 1e18;
    for(double x=L; x<=R+1e-5; x+=0.00001){
        double now = 0,X = 1;
        for(auto &c : C) now += c*X,X *= x;
        answer = min(answer,abs(now));
    }
    cout << fixed << setprecision(20) << answer << endl;
}
0