結果

問題 No.306 さいたま2008
ユーザー otoshigootoshigo
提出日時 2021-09-22 03:13:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 1,209 bytes
コンパイル時間 3,028 ms
コンパイル使用メモリ 198,928 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 18:54:53
合計ジャッジ時間 3,848 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
4,376 KB
testcase_01 AC 18 ms
4,376 KB
testcase_02 AC 17 ms
4,376 KB
testcase_03 AC 18 ms
4,376 KB
testcase_04 AC 18 ms
4,376 KB
testcase_05 AC 18 ms
4,380 KB
testcase_06 AC 18 ms
4,380 KB
testcase_07 AC 17 ms
4,376 KB
testcase_08 AC 18 ms
4,380 KB
testcase_09 AC 18 ms
4,376 KB
testcase_10 AC 17 ms
4,376 KB
testcase_11 AC 17 ms
4,380 KB
testcase_12 AC 18 ms
4,376 KB
testcase_13 AC 17 ms
4,376 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 17 ms
4,380 KB
testcase_16 AC 17 ms
4,376 KB
testcase_17 AC 18 ms
4,376 KB
testcase_18 AC 18 ms
4,376 KB
testcase_19 AC 18 ms
4,376 KB
testcase_20 AC 18 ms
4,376 KB
testcase_21 AC 18 ms
4,376 KB
testcase_22 AC 18 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;  using vvi = vector<vi>;
using vl = vector<ll>;   using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>;
using vm = vector<mint>; using vvm = vector<vm>;
using vpi = vector<pii>; using vvpi = vector<vpi>;
using vpl = vector<pll>; using vvpl = vector<vpl>;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
#define rep(i,m,n) for (int i = m; i < (int)(n); i++)
#define rrep(i,m,n) for (int i = m; i > (int)(n); i--)

long double xa,ya,xb,yb;

long double f(long double y){
    return pow((xa*xa + (y-ya)*(y-ya)),0.5) + pow((xb*xb + (y-yb)*(y-yb)),0.5);
}

int main(){
    cout << fixed << setprecision(10);
    cin >> xa >> ya >> xb >> yb;
    long double low = 0.0, high = 1000.0;
    rep(_,0,10000){
        long double a = (2*low+high)/3, b = (low+2*high)/3;
        if (f(a) >= f(b)) low = a;
        else high = b;
        //cout << low << " " << high << endl;
    }
    cout << low << endl;
}
0