結果
問題 |
No.306 さいたま2008
|
ユーザー |
![]() |
提出日時 | 2017-07-06 02:23:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,678 bytes |
コンパイル時間 | 1,670 ms |
コンパイル使用メモリ | 166,376 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-05 20:23:56 |
合計ジャッジ時間 | 2,445 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 WA * 2 |
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- template<typename Func> double findMinReal(double L, double R, Func f) { //[L, R) double l = L, r = R; rep(i, 0, 101) { double m1 = (l * 2.0 + r) / 3.0; double m2 = (l + r * 2.0) / 3.0; if (f(m1) > f(m2)) l = m1; else r = m2; } return r; } /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ double a, b, c, d; //--------------------------------------------------------------------------------------------------- double f(double x) { double d1 = sqrt(a * a + (b - x) * (b - x)); double d2 = sqrt(c * c + (d - x) * (d - x)); return d1 + d2; } //--------------------------------------------------------------------------------------------------- void _main() { cin >> a >> b >> c >> d; double p = findMinReal(0, 1e9, f); printf("%.10f\n", p); }