結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー しらっ亭しらっ亭
提出日時 2015-08-20 01:01:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 585 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-26 22:14:52
合計ジャッジ時間 1,789 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 31 ms
10,880 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 30 ms
10,752 KB
testcase_13 AC 31 ms
10,752 KB
testcase_14 AC 30 ms
10,880 KB
testcase_15 AC 31 ms
10,752 KB
testcase_16 AC 31 ms
10,880 KB
testcase_17 AC 30 ms
10,752 KB
testcase_18 AC 30 ms
10,752 KB
testcase_19 AC 30 ms
10,880 KB
testcase_20 AC 30 ms
10,880 KB
testcase_21 AC 31 ms
10,752 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 30 ms
10,752 KB
testcase_24 AC 31 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

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