結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-07 17:44:56 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 2,000 ms |
| コード長 | 594 bytes |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-06-29 21:20:21 |
| 合計ジャッジ時間 | 6,638 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 |
コンパイルメッセージ
Syntax OK
ソースコード
h,w = gets.split.map(&:to_i)
ss = []
f=[]
for i in 0...h
line = gets.chomp
f<<[]
for j in 0...w
f[i] << false
if line[j] == '*'
ss << [i,j]
f[i][j] = true
end
end
end
def star(a, b, c)
dx1 = a[0] - b[0]
dy1 = a[1] - b[1]
dx2 = a[0] - c[0]
dy2 = a[1] - c[1]
dx1 * dy2 != dy1 * dx2
end
for i in 0...h
for j in 0...w
if star([i, j], ss[0], ss[1])
f[i][j] = true
for i in 0...h
puts (0...w).map{|j| f[i][j] ? '*' : '-'}.join('')
end
exit 0
end
end
end
p stars