結果

問題 No.306 さいたま2008
ユーザー T0RA1107T0RA1107
提出日時 2021-10-09 15:18:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 827 bytes
コンパイル時間 965 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 7,956 KB
最終ジャッジ日時 2023-10-10 00:42:06
合計ジャッジ時間 2,487 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,772 KB
testcase_01 AC 18 ms
7,788 KB
testcase_02 AC 17 ms
7,784 KB
testcase_03 AC 17 ms
7,908 KB
testcase_04 AC 17 ms
7,868 KB
testcase_05 AC 18 ms
7,784 KB
testcase_06 AC 17 ms
7,832 KB
testcase_07 AC 17 ms
7,784 KB
testcase_08 AC 16 ms
7,932 KB
testcase_09 AC 16 ms
7,916 KB
testcase_10 AC 17 ms
7,824 KB
testcase_11 AC 16 ms
7,844 KB
testcase_12 AC 16 ms
7,812 KB
testcase_13 AC 17 ms
7,796 KB
testcase_14 AC 17 ms
7,956 KB
testcase_15 AC 17 ms
7,916 KB
testcase_16 AC 17 ms
7,840 KB
testcase_17 AC 17 ms
7,808 KB
testcase_18 AC 17 ms
7,840 KB
testcase_19 AC 17 ms
7,812 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 17 ms
7,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def from_read():
    return [int(x) for x in read().splitlines()]

def from_readline():
    return [int(x) for x in readline().split()]

def read_matrix(N, M):
    matrix = [None for i in range(N)]
    for i in range(N):
        matrix[i] = from_readline()
    return matrix

def solve(xa, ya, xb, yb):
    l = 0
    r = 1000
    for _ in range(100):
        c1 = (2*l + r) / 3
        c2 = (l + 2*r) / 3
        L1 = (xa**2 + (c1 - ya)**2)**.5 + (xb**2 + (c1 - yb)**2)**.5
        L2 = (xa**2 + (c2 - ya)**2)**.5 + (xb**2 + (c2 - yb)**2)**.5
        if L1 > L2: l = c1
        else: r = c2
    return l

def main():
    xa, ya = from_readline()
    xb, yb = from_readline()
    print(solve(xa, ya, xb, yb))

if __name__ == "__main__":
    main()

0