結果

問題 No.455 冬の大三角
ユーザー h_noson
提出日時 2017-01-26 15:51:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-29 22:40:34
合計ジャッジ時間 3,395 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int,input().split(' '))
s = [list(input()) for i in range(h)]

found = False
for i in range(h):
    for j in range(w):
        if not found and s[i][j] == '*':
            for k in range(j+1,w):
                if s[i][k] == '*':
                    if i == 0:
                        s[i+1][j] = '*'
                    else:
                        s[i-1][j] = '*'
                    found = True
            if not found:
                if j == 0:
                    s[i][j+1] = '*'
                else:
                    s[i][j-1] = '*'
            found = True
for i in range(h):
    print("".join(s[i]))
0