結果
問題 |
No.306 さいたま2008
|
ユーザー |
|
提出日時 | 2015-11-27 22:56:32 |
言語 | Python2 (2.7.18) |
結果 |
RE
|
実行時間 | - |
コード長 | 540 bytes |
コンパイル時間 | 576 ms |
コンパイル使用メモリ | 7,076 KB |
実行使用メモリ | 8,448 KB |
最終ジャッジ日時 | 2024-09-14 00:14:55 |
合計ジャッジ時間 | 2,562 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 2 RE * 4 |
ソースコード
# -*- 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