結果

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

ソースコード

diff #

ss = input().split()
h = int(ss[0])
w = int(ss[1])
x1 = -1
y1 = -1
x2 = -1
y2 = -1

for i in range(h):
    s = input()
    f = 0
    for j in range(2):
        f = s.find("*",f)
        if f == -1:
            break
        else:
            if x1 == -1:
                x1 = f
                y1 = i
                f += 1
            else:
                x2 = f
                y2 = i

x3 = -1
y3 = -1

if x1 == x2:
    x3 = x1 + 1
    if x3 == w:
        x3 = 0
    y3 = y1
elif y1 == y2:
    x3 = x1
    y3 = y1 + 1
    if y3 == h:
        y3 = 0
else:
    x3 = x1 + 1
    if x3 == w:
        x3 = 0
    y3 = y1

for i in range(h):
    ans = ""
    for j in range(w):
        if (i == y3 and j == x3) or (i == y1 and j == x1) or (i == y2 and j == x2):
            ans += "*"
        else:
            ans += "-"
    print(ans)
0