結果

問題 No.455 冬の大三角
ユーザー compass19
提出日時 2016-12-10 16:19:35
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-29 21:37:23
合計ジャッジ時間 3,914 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

# データ入力
h, w = map(int, input().split())

star_pos = dict()
count = 1
sky = list()
for row in range(h):
	s = input()
	for i, elm in enumerate(s):
		if elm == '*':
			star_pos[count] = (row, i)
			count += 1
	sky.append(list(s))

# 星の追加候補は(0, 0), (1, 0), (0, 1)の3つ
if star_pos[1][0] == star_pos[2][0]:
	if star_pos[1][0] != 0:
		x, y = 0, 0
	else:
		x, y = 0, 1
elif star_pos[1][1] == star_pos[2][1]:
	if star_pos[1][1] != 0:
		x, y = 0, 0
	else:
		x, y = 1, 0
elif star_pos[1][1]*star_pos[2][0] == star_pos[2][1]*star_pos[1][0]:
	x, y = 0, 1
else:
	x, y = 0, 0

sky[y][x] = '*'
for s in sky:
	print(''.join(s))
0