結果
問題 | No.1455 拡張ROTN |
ユーザー |
![]() |
提出日時 | 2025-03-26 15:44:24 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 967 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 61,692 KB |
最終ジャッジ日時 | 2025-03-26 15:44:38 |
合計ジャッジ時間 | 1,819 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
def process_char(c, k):if k == 0:return cif not c.isdigit():# Process lettersif c.islower():base = ord('a')else:base = ord('A')shifted = (ord(c) - base + k) % 26return chr(base + shifted)else:d = int(c)if d < 9:possible_m = 9 - dif k <= possible_m:return str(d + k)else:k -= possible_m# Now it becomes 9, and we need to process one more stepk -= 1 # Convert 9 to the strings = 'CpCzNkSuTbEoA'return ''.join(process_char(ch, k) for ch in s)else:# d == 9s = 'CpCzNkSuTbEoA'k -= 1return ''.join(process_char(ch, k) for ch in s)S0 = input().strip()N = int(input())result = []for c in S0:result.append(process_char(c, N))print(''.join(result))