結果

問題 No.306 さいたま2008
ユーザー kuhaku
提出日時 2020-01-15 07:27:28
言語 C++17(1z)
(gcc 9.2.0)
結果
AC  
実行時間 4 ms
コード長 2,181 Byte
コンパイル時間 4,444 ms
使用メモリ 3,592 KB
最終ジャッジ日時 2020-01-15 07:27:35

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
0_0.txt AC 4 ms
3,592 KB
0_1.txt AC 0 ms
3,388 KB
0_2.txt AC 4 ms
3,592 KB
1_0.txt AC 0 ms
3,468 KB
1_1.txt AC 0 ms
3,380 KB
1_2.txt AC 4 ms
3,400 KB
1_3.txt AC 0 ms
3,484 KB
1_4.txt AC 4 ms
3,392 KB
1_5.txt AC 0 ms
3,476 KB
1_6.txt AC 0 ms
3,404 KB
2_0.txt AC 4 ms
3,484 KB
2_1.txt AC 4 ms
3,392 KB
2_2.txt AC 0 ms
3,592 KB
2_3.txt AC 0 ms
3,392 KB
2_4.txt AC 4 ms
3,480 KB
2_5.txt AC 0 ms
3,472 KB
2_6.txt AC 0 ms
3,360 KB
3_0.txt AC 4 ms
3,472 KB
3_1.txt AC 4 ms
3,408 KB
3_2.txt AC 0 ms
3,592 KB
3_3.txt AC 4 ms
3,476 KB
3_4.txt AC 0 ms
3,456 KB
system_test1.txt AC 4 ms
3,480 KB
テストケース一括ダウンロード

ソースコード

diff #
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<double>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<vector<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const ld EPS = 1e-11;

ld dist(const Pld &a, const Pld &b){
	return sqrt(pow(a.fs-b.fs, 2)+pow(a.sc-b.sc, 2));
}

int main(void){
	Pld p1, p2;
	cin >> p1.fs >> p1.sc >> p2.fs >> p2.sc;

	ld l = 0, r = 1000;
	while(r-l > EPS){
		ld m1 = (l*2+r)/3, m2 = (l+r*2)/3;
		if(dist((Pld){0.0, m1}, p1)+dist((Pld){0.0, m1}, p2) > dist((Pld){0.0, m2}, p1)+dist((Pld){0.0, m2}, p2)) l = m1;
		else r = m2;
	}
	setp(10);
	co(l);

	return 0;
}
0