結果
問題 | No.1455 拡張ROTN |
ユーザー | 小野寺健 |
提出日時 | 2021-04-30 14:16:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 528 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-18 11:51:41 |
合計ジャッジ時間 | 1,539 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
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) + N) else: SN += replace('CpCzNkSuTbEoA', N - (10 - int(c))) print(SN)