結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー yuuDot
提出日時 2025-09-06 13:24:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 65,280 KB
最終ジャッジ日時 2025-09-06 13:25:42
合計ジャッジ時間 2,844 ms
ジャッジサーバーID
(参考情報)
judge2 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for i in range(h):
    j = 0
    while j < len(s[i]) - 1:
        if s[i][j] == "9" and s[i][j + 1] == "y":
            s[i][j + 1] = "Y"
            s[i][j + 5] = "0"
        elif s[i][j] == "y" and s[i][j + 1] == "9":
            s[i][j] = "Y"
            s[i][j + 1] = "1"

        j += 1

for line in s:
    ans = line
    j = 0
    while j < len(ans):
        if ans[j] == "0":
            ans[j] = "y"
        elif ans[j] == "1":
            ans[j] = "9"

        j += 1

    print("".join(ans))
0