結果
| 問題 |
No.306 さいたま2008
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-22 03:13:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 1,209 bytes |
| コンパイル時間 | 1,784 ms |
| コンパイル使用メモリ | 193,992 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-14 12:18:03 |
| 合計ジャッジ時間 | 3,176 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
ソースコード
//#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;
}