【マップの扱い 1】マップの書き換え・1 マス Python3編
code:py
H, W = map(int, input().split())
lines = []
for _ in range(H):
lines.append(line)
x, y = map(int, input().split())
else:
for i in lines:
print(''.join(i))
code:py
H, W = map(int, input().split())
lines = []
for _ in range(H):
lines.append(line)
y, x = map(int, input().split())
# 上の行
if y - 1 >= 0:
target_upper_line = linesy - 1 if target_upper_linex == '#': else:
# 中央の行の左・中央・右
if x - 1 >= 0: # 左側のマス
if target_linex - 1 == '#': else:
if target_linex == '#': # 中央のマス else:
if x + 1 < W: # 右側のマス
if target_linex + 1 == '#': else:
# 下の行
if y + 1 < H:
target_under_line = linesy + 1 if target_under_linex == '#': else:
# 結果出力
for line in lines:
print(''.join(line))