結果

問題 No.306 さいたま2008
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-06-09 16:40:20
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 457 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 59,616 KB
実行使用メモリ 13,952 KB
最終ジャッジ日時 2024-04-17 12:15:10
合計ジャッジ時間 7,016 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

double xa, ya, xb, yb;
double f(double py){
	return sqrt(pow(xa - 0, 2) + pow(ya - py, 2)) + sqrt(pow(xb - 0, 2) + pow(yb - py, 2));
}
double search(double l, double r,int cnt){
	while(cnt--){
		if(f((l*2+r)/3)<=f((l+r*2)/3)) r=(l+r*2)/3;
		else l=(l*2+r)/3;
	}
	return (l+r)/2;
}


int main(){


	cin >> xa >> ya;
	cin >> xb >> yb;

	printf("%.12f\n",search(0, 1000, 100000000));
}
0