結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー 👑 Kazun
提出日時 2020-05-31 18:13:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 806 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 54,012 KB
最終ジャッジ日時 2024-11-17 22:31:17
合計ジャッジ時間 1,910 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

class Vector2():
    def __init__(self,x=0,y=0):
        self.x=x
        self.y=y

    def __neg__(self):
        return Vector2(-self.x,-self.y)
    
    def __add__(self,other):
        v=Vector2()
        v.x=self.x+other.x
        v.y=self.y+other.y
        return v

    def __sub__(self,other):
        return self+(-other)

    def inner(u,v):
        return u.x*v.x+u.y*v.y

    def __str__(self):
        return "{} {}".format(self.x,self.y)

X=[0,0,0]
Y=[0,0,0]
X[0],Y[0],X[1],Y[1],X[2],Y[2]=map(int,input().split())

V=[]
for k in range(3):
    V.append(Vector2(X[k],Y[k]))

f=0
for i in range(3):
    j=(i+1)%3
    k=(i-1)%3

    u,v,w=V[i],V[j],V[k]
    
    if (f==0) and ((v-u).inner(v-u)==(w-u).inner(w-u)) and (v-u).inner(w-u)==0:
        f=1
        print(-u+v+w)

if f==0:
    print(-1)
0