結果

問題 No.410 出会い
ユーザー mossari_aozoramossari_aozora
提出日時 2019-10-03 16:02:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-03 06:28:32
合計ジャッジ時間 1,618 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def solve():
    # pの座標
    p = input().split(' ')
    px = int(p[0])
    py = int(p[1])
    # qの座標
    q = input().split(' ')
    qx = int(q[0])
    qy = int(q[1])
    # 交差地点の座標
    ix = (qx + px) / 2
    iy = (qy + py) / 2
    # 交差地点座標がどちらも割り切れない場合
    # x座標は切り上げ、y座標は切り捨て
    if ((qx + px) % 2 != 0 and (qy + py) % 2 != 0):
        ix = math.ceil((qx + px) / 2)
        iy = math.floor((qy + py) / 2)

    distance = abs(ix - px) + abs(iy - py)

    print(distance)


solve()
0