結果

問題 No.455 冬の大三角
ユーザー horiesiniti
提出日時 2018-03-13 08:19:10
言語 Ruby
(3.4.1)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 40 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-06-30 04:49:21
合計ジャッジ時間 7,236 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

h,w=gets.split.map{|e| e.to_i}
s=STDIN.read.split
ps=[]
y1=0
s.each{|s2|
	x1=0
	s2.chars{|e|
		if e=="*"
			ps<<[y1,x1]
		end
		x1+=1
	}
	y1+=1
}
h.times{|y|
	w.times{|x|
		x1=ps[0][1]-x
		y1=ps[0][0]-y
		x2=ps[1][1]-x
		y2=ps[1][0]-y
		if x1*y2-x2*y1!=0
			ps<<[y,x]
			break
		end
	}
	if ps.size==3
		break
	end
}
h.times{|y|
	w.times{|x|
		if ps.index([y,x])==nil
			print "-"
		else
			print "*"
		end
	}
	print "\n"
}
0