結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
小指が強い人
|
| 提出日時 | 2016-01-01 02:06:24 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 244 ms |
| コンパイル使用メモリ | 7,168 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-10-08 03:40:59 |
| 合計ジャッジ時間 | 3,658 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 1 |
コンパイルメッセージ
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
ソースコード
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 + v2.x, " ", a[i1].y + v2.y, "\n"
exit
end
end
puts -1
小指が強い人