結果

問題 No.1455 拡張ROTN
ユーザー dangodango
提出日時 2023-06-24 21:32:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 76,016 KB
最終ジャッジ日時 2023-09-14 17:26:47
合計ジャッジ時間 3,607 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,248 KB
testcase_01 AC 72 ms
71,360 KB
testcase_02 AC 77 ms
76,004 KB
testcase_03 AC 73 ms
71,368 KB
testcase_04 AC 79 ms
76,016 KB
testcase_05 AC 72 ms
71,264 KB
testcase_06 AC 76 ms
74,784 KB
testcase_07 AC 72 ms
71,220 KB
testcase_08 AC 73 ms
71,256 KB
testcase_09 AC 71 ms
71,352 KB
testcase_10 AC 71 ms
71,240 KB
testcase_11 AC 72 ms
71,352 KB
testcase_12 AC 72 ms
71,488 KB
testcase_13 AC 72 ms
71,440 KB
testcase_14 AC 73 ms
71,248 KB
testcase_15 AC 72 ms
71,408 KB
testcase_16 AC 71 ms
71,124 KB
testcase_17 AC 70 ms
71,476 KB
testcase_18 AC 71 ms
71,352 KB
testcase_19 AC 70 ms
71,264 KB
testcase_20 AC 71 ms
71,216 KB
testcase_21 AC 70 ms
70,988 KB
testcase_22 AC 71 ms
70,972 KB
testcase_23 AC 71 ms
71,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(c, n):
    if 'a' <= c <= 'z':
        return chr(ord('a') + (ord(c) - ord('a') + n % 26) % 26)
    elif 'A' <= c <= 'Z':
        return chr(ord('A') + (ord(c) - ord('A') + n % 26) % 26)
    else:
        raise ValueError
s = input()
n = int(input())
result = []
for c in s:
    if '0' <= c <= '9':
        m = n + int(c)
        if m > 9:
            result.append(''.join([f(c2, m - 10) for c2 in "CpCzNkSuTbEoA"]))
        else:
            result.append(str(m))
    else:
        result.append(f(c, n))
print(''.join(result))
0