結果

問題 No.306 さいたま2008
ユーザー roiti46roiti46
提出日時 2015-11-27 22:56:32
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 540 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 6,488 KB
実行使用メモリ 8,076 KB
最終ジャッジ日時 2023-10-12 00:19:03
合計ジャッジ時間 2,905 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
8,024 KB
testcase_01 AC 23 ms
7,916 KB
testcase_02 RE -
testcase_03 AC 23 ms
7,864 KB
testcase_04 AC 23 ms
8,024 KB
testcase_05 AC 23 ms
7,904 KB
testcase_06 AC 23 ms
7,900 KB
testcase_07 AC 23 ms
7,860 KB
testcase_08 AC 23 ms
7,832 KB
testcase_09 AC 24 ms
7,860 KB
testcase_10 AC 23 ms
7,904 KB
testcase_11 AC 23 ms
7,832 KB
testcase_12 AC 24 ms
8,076 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 23 ms
7,880 KB
testcase_16 AC 23 ms
7,884 KB
testcase_17 AC 23 ms
7,960 KB
testcase_18 RE -
testcase_19 AC 23 ms
7,836 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 23 ms
7,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

def dist(y):
    res = math.sqrt((ya - y)**2 + xa**2) + math.sqrt((yb- y)**2 + xb**2)
    return res

xa, ya = map(int, raw_input().split())
xb, yb = map(int, raw_input().split())

low, hi = min(ya, yb), max(ya, yb) 
while hi - low > 1e-12:
    mid_l = (2*low + hi)/3.0
    mid_r = (low + 2*hi)/3.0
    d_l = dist(mid_l)
    d_r = dist(mid_r)
    if d_l < d_r:
        hi = mid_r
    else:
        low = mid_l
print "%.10f" % mid_l
0