結果
| 問題 |
No.1455 拡張ROTN
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 21:32:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 726 bytes |
| コンパイル時間 | 215 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-12-15 15:38:18 |
| 合計ジャッジ時間 | 2,093 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
s = input()
n = int(input())
ans = ""
for i in s:
if i.isdigit():
if (n - (10 - int(i))) < 0:
ans += str(int(i) + n)
else:
now = "CpCzNkSuTbEoA"
shift = (n - (10 - int(i))) % 26
new = ""
for j in now:
if j.islower():
new += chr((ord(j) - ord("a") + shift) % 26 + ord("a"))
else:
new += chr((ord(j) - ord("A") + shift) % 26 + ord("A"))
ans += new
elif i.islower():
shift = n % 26
ans += chr((ord(i) - ord("a") + shift) % 26 + ord("a"))
else:
shift = n % 26
ans += chr((ord(i) - ord("A") + shift) % 26 + ord("A"))
print(ans)