結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー 👑 obakyan
提出日時 2019-04-04 23:30:14
言語 Lua
(LuaJit 2.1.1734355927)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 787 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 07:25:28
合計ジャッジ時間 1,271 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 11 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

local x1, y1, x2, y2, x3, y3 = io.read("*n", "*n", "*n", "*n", "*n", "*n")
local x4, y4 = nil, nil
if((y2 - y1) * (y3 - y1)  == -(x2 - x1) * (x3 - x1)) then
  if(math.abs(y2 - y1) == math.abs(x3 - x1) and math.abs(x2 - x1) == math.abs(y3 - y1)) then
    x4, y4 = x2 + x3 - x1, y2 + y3 - y1
  end
elseif((y1 - y2) * (y3 - y2)  == -(x1 - x2) * (x3 - x2)) then
  if(math.abs(y1 - y2) == math.abs(x3 - x2) and math.abs(x1 - x2) == math.abs(y3 - y2)) then
    x4, y4 = x1 + x3 - x2, y1 + y3 - y2
  end
elseif((y1 - y3) * (y2 - y3)  == -(x1 - x3) * (x2 - x3)) then
  if(math.abs(y1 - y3) == math.abs(x2 - x3) and math.abs(x1 - x3) == math.abs(y2 - y3)) then
    x4, y4 = x1 + x2 - x3, y1 + y2 - y3
  end
else
  candraw = false
end
print(x4 ~= nil and string.format("%d %d\n", x4, y4) or "-1")
0