結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,752 KB
testcase_01 AC 18 ms
7,836 KB
testcase_02 AC 17 ms
7,752 KB
testcase_03 AC 17 ms
7,836 KB
testcase_04 AC 17 ms
7,900 KB
testcase_05 AC 17 ms
7,764 KB
testcase_06 AC 17 ms
7,756 KB
testcase_07 AC 17 ms
7,756 KB
testcase_08 AC 18 ms
7,900 KB
testcase_09 AC 17 ms
7,812 KB
testcase_10 AC 18 ms
7,780 KB
testcase_11 AC 17 ms
7,848 KB
testcase_12 AC 18 ms
7,752 KB
testcase_13 AC 18 ms
7,892 KB
testcase_14 AC 17 ms
7,792 KB
testcase_15 AC 18 ms
7,760 KB
testcase_16 AC 17 ms
7,832 KB
testcase_17 AC 18 ms
7,848 KB
testcase_18 AC 18 ms
7,844 KB
testcase_19 AC 17 ms
7,764 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 17 ms
7,764 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 = 10000
    for _ in range(300):
        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