結果

問題 No.455 冬の大三角
ユーザー magurogumamaguroguma
提出日時 2017-08-27 15:44:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 1,290 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 8,476 KB
最終ジャッジ日時 2023-09-12 15:02:53
合計ジャッジ時間 4,597 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,840 KB
testcase_01 AC 15 ms
7,820 KB
testcase_02 AC 16 ms
7,884 KB
testcase_03 AC 16 ms
7,820 KB
testcase_04 AC 15 ms
7,768 KB
testcase_05 AC 15 ms
7,836 KB
testcase_06 AC 15 ms
7,820 KB
testcase_07 AC 15 ms
7,820 KB
testcase_08 AC 24 ms
8,436 KB
testcase_09 AC 15 ms
7,864 KB
testcase_10 AC 15 ms
7,824 KB
testcase_11 AC 15 ms
7,840 KB
testcase_12 AC 16 ms
7,800 KB
testcase_13 AC 15 ms
7,816 KB
testcase_14 AC 15 ms
7,804 KB
testcase_15 AC 15 ms
8,000 KB
testcase_16 AC 15 ms
7,764 KB
testcase_17 AC 15 ms
7,800 KB
testcase_18 AC 16 ms
7,764 KB
testcase_19 AC 16 ms
7,884 KB
testcase_20 AC 16 ms
7,888 KB
testcase_21 AC 15 ms
8,004 KB
testcase_22 AC 15 ms
7,816 KB
testcase_23 AC 15 ms
7,884 KB
testcase_24 AC 16 ms
7,956 KB
testcase_25 AC 15 ms
7,956 KB
testcase_26 AC 15 ms
7,804 KB
testcase_27 AC 16 ms
7,800 KB
testcase_28 AC 16 ms
7,816 KB
testcase_29 AC 21 ms
8,412 KB
testcase_30 AC 20 ms
8,304 KB
testcase_31 AC 18 ms
8,352 KB
testcase_32 AC 18 ms
8,260 KB
testcase_33 AC 22 ms
8,476 KB
testcase_34 AC 16 ms
7,840 KB
testcase_35 AC 20 ms
8,428 KB
testcase_36 AC 19 ms
8,332 KB
testcase_37 AC 17 ms
8,324 KB
testcase_38 AC 17 ms
8,400 KB
testcase_39 AC 22 ms
8,372 KB
testcase_40 AC 19 ms
8,276 KB
testcase_41 AC 19 ms
8,268 KB
testcase_42 AC 18 ms
8,252 KB
testcase_43 AC 17 ms
8,164 KB
testcase_44 AC 17 ms
8,248 KB
testcase_45 AC 21 ms
8,448 KB
testcase_46 AC 19 ms
8,412 KB
testcase_47 AC 18 ms
8,404 KB
testcase_48 AC 17 ms
8,228 KB
testcase_49 AC 15 ms
7,824 KB
testcase_50 AC 15 ms
7,884 KB
testcase_51 AC 15 ms
7,804 KB
testcase_52 AC 16 ms
7,808 KB
testcase_53 AC 16 ms
8,304 KB
testcase_54 AC 16 ms
7,856 KB
testcase_55 AC 16 ms
7,888 KB
testcase_56 AC 17 ms
8,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(input())

# 2つの見つかった星の座標を取得
stars = []
for i in range(H):
    for j in range(W):
        if S[i][j] == '*':
            stars.append((j,i)) # 座標に注意

A = stars[0]
B = stars[1]
C = None
if A[0] == B[0]:
    # 星Aと星Bのx座標が等しい場合,Wの範囲内で異なるx座標を取った星の座標を選べば良い
    for x in range(W):
        if x != A[0]:
            C = (x,0)   # y座標は適当
            break
else:
    if A[1] == B[1]:
        # y座標が等しい場合,Hの範囲内で異なるy座標を取った星の座標を選べば良い
        for y in range(H):
            if y != A[1]:
                C = (0,y) # x座標は適当
                break
    else:
        # x座標もy座標も異なる場合は,それぞれのx座標とy座標を採用することで直角三角形を作れる
        C = (A[0], B[1])

'''
if C == None:
    print('error!')
else:
    print(C)
'''

# SのC座標を*で書き換える
temp = S[C[1]]
temp = list(temp)
temp[C[0]] = '*'
temp = ''.join(temp)
S[C[1]] = temp
# 描画
for i in range(H):
    for j in range(W):
        print(S[i][j], end='') if j<W-1 else print(S[i][j])
0