結果

問題 No.306 さいたま2008
ユーザー tjaketjake
提出日時 2015-12-04 00:05:58
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 6,720 KB
実行使用メモリ 6,200 KB
最終ジャッジ日時 2023-10-12 09:38:55
合計ジャッジ時間 1,508 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,068 KB
testcase_01 AC 12 ms
6,180 KB
testcase_02 AC 11 ms
6,048 KB
testcase_03 AC 12 ms
6,200 KB
testcase_04 AC 12 ms
6,112 KB
testcase_05 AC 11 ms
6,068 KB
testcase_06 AC 11 ms
6,140 KB
testcase_07 AC 12 ms
6,040 KB
testcase_08 AC 12 ms
6,072 KB
testcase_09 AC 11 ms
6,028 KB
testcase_10 AC 12 ms
6,036 KB
testcase_11 AC 12 ms
6,136 KB
testcase_12 AC 12 ms
6,136 KB
testcase_13 AC 11 ms
6,176 KB
testcase_14 AC 12 ms
6,016 KB
testcase_15 AC 12 ms
6,176 KB
testcase_16 AC 12 ms
6,068 KB
testcase_17 AC 12 ms
6,136 KB
testcase_18 AC 11 ms
5,972 KB
testcase_19 AC 12 ms
6,044 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 11 ms
6,136 KB
権限があれば一括ダウンロードができます

ソースコード

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

def calc(yp):
    return sqrt(xa**2+(ya-yp)**2) + sqrt(xb**2+(yb-yp)**2)

left = ya; right = yb
while 1:
    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 left
0