結果

問題 No.306 さいたま2008
ユーザー tjaketjake
提出日時 2015-12-04 00:13:52
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 6,884 KB
実行使用メモリ 6,216 KB
最終ジャッジ日時 2023-10-12 09:40:31
合計ジャッジ時間 1,303 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
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 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
inputs = lambda:map(int, raw_input().split())
xa, ya = inputs()
xb, yb = inputs()

if ya > yb:
    xa, ya, xb, yb = xb, yb, xa, ya
xa2 = xa**2*10**30
xb2 = xb**2*10**30
ya *= 10**15
yb *= 10**15

def calc(yp):
    return sqrt(xa2+(ya-yp)**2) + sqrt(xb2+(yb-yp)**2)

left = ya; right = yb
while 1:
    print left, right
    lm = (2*left+right)/3
    rm = (left+2*right)/3
    lc = calc(lm)
    rc = calc(rm)
    if lc < rc:
        if rm==right: break
        right = rm
    else:
        if lm==left: break
        left = lm
print "%.08f" % (left/10.**15)
0