結果
問題 |
No.1455 拡張ROTN
|
ユーザー |
|
提出日時 | 2023-06-24 21:32:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 569 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 59,392 KB |
最終ジャッジ日時 | 2024-07-02 00:33:57 |
合計ジャッジ時間 | 2,138 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
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))