結果

問題 No.1455 拡張ROTN
コンテスト
ユーザー 小野寺健
提出日時 2021-04-30 14:13:01
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 528 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 517 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 36,056 KB
最終ジャッジ日時 2026-04-02 04:19:06
合計ジャッジ時間 3,789 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

S = input()
N = int(input())

def replace(S, n):
    if n == 0:
        return S
    ans = ''
    for c in S:
        if c.islower():
            ans += chr((ord(c) - ord('a') + n) % 26 +ord('a'))
        elif c.isupper():
            ans += chr((ord(c) - ord('A') + n) % 26 +ord('A'))
    return ans

SN = ''
for c in S:
    if c.isalpha():
        SN += replace(c, N)
    else:
        if 9 - int(c) >= N:
            SN += chr(ord(c) + 1)
        else:
            SN += replace('CpCzNkSuTbEoA', N - (10 - int(c)))

print(SN)
0