結果

問題 No.306 さいたま2008
ユーザー tookunn_1213tookunn_1213
提出日時 2016-01-30 10:20:35
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 7,148 KB
実行使用メモリ 6,532 KB
最終ジャッジ日時 2023-10-21 17:50:07
合計ジャッジ時間 1,242 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import math
def calc(x,y):
	return math.sqrt(x * x + y * y)
xa,ya = map(int,raw_input().split())
xb,yb = map(int,raw_input().split())
if ya > yb:
	ya,yb,xa,xb = yb,ya,xb,xa
high = yb * 1.0
low = ya * 1.0
mid = (high + low) / 2.0
pre = calc(mid - ya,xa) + calc(yb - mid,xb)
for i in range(1 << 10):
	mid = (high + low) / 2.0
	#print mid
	res = calc(mid - ya,xa) + calc(yb - mid,xb)
	if res <= pre:
		high = mid
		pre = res
	else:
		low = mid
print mid
0