結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー maimai
提出日時 2017-02-04 19:45:24
言語 Ruby
(3.3.0)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 11,228 KB
実行使用メモリ 15,924 KB
最終ジャッジ日時 2023-08-25 20:14:08
合計ジャッジ時間 3,664 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
15,672 KB
testcase_01 AC 93 ms
15,916 KB
testcase_02 AC 93 ms
15,712 KB
testcase_03 AC 91 ms
15,712 KB
testcase_04 AC 93 ms
15,924 KB
testcase_05 AC 92 ms
15,848 KB
testcase_06 AC 91 ms
15,764 KB
testcase_07 AC 92 ms
15,704 KB
testcase_08 AC 91 ms
15,628 KB
testcase_09 AC 94 ms
15,852 KB
testcase_10 AC 92 ms
15,664 KB
testcase_11 AC 91 ms
15,852 KB
testcase_12 AC 91 ms
15,816 KB
testcase_13 AC 92 ms
15,808 KB
testcase_14 AC 91 ms
15,616 KB
testcase_15 AC 90 ms
15,732 KB
testcase_16 AC 92 ms
15,708 KB
testcase_17 AC 91 ms
15,852 KB
testcase_18 AC 91 ms
15,776 KB
testcase_19 AC 92 ms
15,912 KB
testcase_20 AC 90 ms
15,664 KB
testcase_21 AC 91 ms
15,608 KB
testcase_22 AC 89 ms
15,884 KB
testcase_23 AC 91 ms
15,920 KB
testcase_24 AC 92 ms
15,716 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:32: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

require 'matrix'
ax,ay,bx,by,cx,cy=gets.split.map! &:to_i

def pr(v); puts "#{v[0]} #{v[1]}"; end

p1 = Vector[ax,ay]
p2 = Vector[bx,by]
p3 = Vector[cx,cy]

v1 = p1-p2
v2 = p2-p3
v3 = p3-p1

if v1.dot(v2) == 0
    if v1.r==v2.r
        pr p1-v2
        exit
    end
end
if v2.dot(v3) == 0
    if v2.r==v3.r
        pr p2-v3
        exit
    end
end
if v3.dot(v1) == 0
    if v3.r==v1.r
        pr p3-v1
        exit
    end
end
p -1
0