結果

問題 No.285 消費税2
ユーザー tjake
提出日時 2015-12-04 00:13:21
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 578 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 08:35:06
合計ジャッジ時間 1,361 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 26
権限があれば一括ダウンロードができます

ソースコード

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