結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー 小指が強い人小指が強い人
提出日時 2016-08-04 22:10:19
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-24 15:33:39
合計ジャッジ時間 3,523 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
12,160 KB
testcase_01 AC 94 ms
12,160 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 91 ms
12,160 KB
testcase_06 AC 92 ms
12,160 KB
testcase_07 AC 91 ms
12,160 KB
testcase_08 AC 92 ms
12,160 KB
testcase_09 AC 93 ms
12,288 KB
testcase_10 AC 91 ms
12,032 KB
testcase_11 WA -
testcase_12 AC 91 ms
12,160 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 92 ms
12,032 KB
testcase_16 WA -
testcase_17 AC 91 ms
12,160 KB
testcase_18 AC 94 ms
12,160 KB
testcase_19 AC 92 ms
12,160 KB
testcase_20 WA -
testcase_21 AC 91 ms
12,032 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:26: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:7: warning: assigned but unused variable - vs1
Main.rb:8: warning: assigned but unused variable - vs2
Main.rb:9: warning: assigned but unused variable - ct
Syntax OK

ソースコード

diff #

coord = Struct.new(:x, :y)
s = gets.split.map(&:to_i)
a = Array.new
a.push(coord.new(s[0], s[1]))
a.push(coord.new(s[2], s[3]))
a.push(coord.new(s[4], s[5]))
vs1 = coord.new
vs2 = coord.new
ct = -1
3.times do |i|
    i1 = (i + 1) % 3
    i2 = (i + 2) % 3
    v1 = coord.new(a[i1].x - a[i].x, a[i1].y - a[i].y)
    v2 = coord.new(a[i2].x - a[i].x, a[i2].y - a[i].y)
    c = v1.x * v1.y + v2.x * v2.y
    if c == 0
        d1 = v1.x ** 2 + v1.y ** 2
        d2 = v2.x ** 2 + v2.y ** 2
        if d1 != d2
            break
        end
        print a[i1].x + v1.y, " ", a[i1].y + v1.x, "\n"
        exit
    end
end
puts -1
0