結果
問題 | No.2970 三次関数の絶対値 |
ユーザー |
|
提出日時 | 2025-01-10 23:18:51 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 832 bytes |
コンパイル時間 | 5,031 ms |
コンパイル使用メモリ | 273,900 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-10 23:19:00 |
合計ジャッジ時間 | 7,596 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; constexpr int MOD = 998244353; #define ov4(a, b, c, d, name, ...) name #define rep3(i, a, b, c) for(ll i = (a); i < (b); i += (c)) #define rep2(i, a, b) rep3(i, a, b, 1) #define rep1(i, n) rep2(i, 0, n) #define rep0(n) rep1(aaaaa, n) #define rep(...) ov4(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__) #define per(i, a, b) for(ll i = (a)-1; i >= (b); i--) #define all(v) v.begin(), v.end() int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int C[4]; int L,R; rep(i,4)cin>>C[i]; cin>>L>>R; const int K=100000; auto f=[C](double x){ return C[0]+C[1]*x+C[2]*x*x+C[3]*x*x*x; }; double ans=K; rep(i,L*K,R*K+1){ ans=min(ans,abs(f(double(i)/K))); } cout<<setprecision(10)<<fixed<<ans<<'\n'; }