結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
7,888 KB
testcase_01 AC 23 ms
7,868 KB
testcase_02 AC 23 ms
7,916 KB
testcase_03 AC 24 ms
7,972 KB
testcase_04 AC 24 ms
7,932 KB
testcase_05 AC 25 ms
7,904 KB
testcase_06 AC 22 ms
7,968 KB
testcase_07 AC 23 ms
8,108 KB
testcase_08 AC 24 ms
8,092 KB
testcase_09 AC 23 ms
8,092 KB
testcase_10 AC 23 ms
7,852 KB
testcase_11 AC 23 ms
8,096 KB
testcase_12 AC 23 ms
8,092 KB
testcase_13 AC 22 ms
7,768 KB
testcase_14 AC 23 ms
7,912 KB
testcase_15 AC 23 ms
7,892 KB
testcase_16 AC 22 ms
7,900 KB
testcase_17 AC 23 ms
7,880 KB
testcase_18 AC 23 ms
7,768 KB
testcase_19 AC 23 ms
8,084 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 23 ms
7,888 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-11:
    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" % ((low + hi)/2.0)
0