結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー しらっ亭
提出日時 2015-08-20 01:01:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 585 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-11-14 13:51:00
合計ジャッジ時間 1,768 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def solve():
    x1, y1, x2, y2, x3, y3 = list(map(int, input().split()))

    v12 = (x1 - x2, y1 - y2)
    v13 = (x1 - x3, y1 - y3)
    v23 = (x2 - x3, y2 - y3)
    d12 = v12[0]**2 + v12[1]**2
    d13 = v13[0]**2 + v13[1]**2
    d23 = v23[0]**2 + v23[1]**2

    if d12 == d13 and d23 == d12 + d13:
        print(x3 - v12[0], y3 - v12[1])
    elif d12 == d23 and d13 == d12 + d23:
        print(x3 + v12[0], y3 + v12[1])
    elif d13 == d23 and d12 == d13 + d23:
        print(x2 + v13[0], y2 + v13[1])
    else:
        print(-1)

if __name__ == '__main__':
    solve()
0