結果
| 問題 |
No.1455 拡張ROTN
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-08 22:05:27 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 889 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-06-23 17:58:57 |
| 合計ジャッジ時間 | 1,778 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
import string
alphs = list(string.ascii_lowercase)
Alphs = list(string.ascii_uppercase)
T = "CpCzNkSuTbEoA"
S = list(input())
n = int(input())
m = len(S)
ANS = []
for i in range(m):
if ord('0') <= ord(S[i]) <= ord('9'):
num = ord('9') - ord(S[i]) + 1
if n >= num:
cnt = n - num
for s in T:
if s.islower():
ANS.append(alphs[(ord(s) - ord('a') + cnt) % 26])
elif s.isupper():
ANS.append(Alphs[(ord(s) - ord('A') + cnt) % 26])
else:
cnt = n
ANS.append(str(int(S[i]) + cnt))
else:
cnt = n
s = S[i]
if s.islower():
ANS.append(alphs[(ord(s) - ord('a') + cnt) % 26])
elif s.isupper():
ANS.append(Alphs[(ord(s) - ord('A') + cnt) % 26])
print(''.join(ANS))