結果
問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
ユーザー |
👑 |
提出日時 | 2019-09-05 21:42:58 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 785 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-13 03:47:46 |
合計ジャッジ時間 | 1,026 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
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", x4, y4) or "-1")