問題一覧 > 通常問題

No.1455 Extended ROTN

レベル : / AI推定難易度 : 725 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 133
作問者 : Falcon_ / テスター : shiomusubi496 NaHCO314
お気に入りにしたユーザー ProblemId : 4824 / 自分の提出
問題文最終更新日: 2021-11-22 00:20:19
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
新入生プログラミングコンテスト 2021(夜の部) (順位表) の他の問題:

Problem Statement

We define the operation of shifting a character $c$ by $1$ as follows.

  • If $c$ is a lowercase English letter, replace $c$ with the letter $1$ position after it in alphabetical order. However, if $c$ is z, replace it with a.

  • If $c$ is an uppercase English letter, replace $c$ with the letter $1$ position after it in alphabetical order. However, if $c$ is Z, replace it with A.

  • If $c$ is a digit, regard $c$ as a number and replace it with the number obtained by adding $1$. However, if $c$ is 9, replace it with CpCzNkSuTbEoA.

A string $S_0$ is given. For any $i$ satisfying $1\leq i\leq N$, let $S_i$ be the string obtained by shifting each character of $S_{i-1}$ by $1$.
Given $S_0$ and $N$, find $S_N$.

Constraints

  • $S_0$ is a string consisting of lowercase English letters, uppercase English letters, and digits
  • $N$ is given as an integer
  • $1\leq |S_0|\leq 100$
  • $0\leq N\leq 10^{18}$

Input

$S_0$
$N$

Output

$S_N$

Print $S_N$ on one line, followed by a newline.

Sample

Sample 1
Input
CpCzNkSuTbEoA
2
Output
ErEbPmUwVdGqC

$S_1$ is DqDaOlTvUcFpB, and $S_2$ is ErEbPmUwVdGqC.

Sample 2
Input
3141592653589793238ushitapu
7
Output
CpCzNkSuTbEoA8DqDaOlTvUcFpB8ErEbPmUwVdGqCIvIfTqYaZhKuG9FsFcQnVxWeHrDErEbPmUwVdGqCCpCzNkSuTbEoAErEbPmUwVdGqCHuHeSpXzYgJtFIvIfTqYaZhKuGGtGdRoWyXfIsEIvIfTqYaZhKuGCpCzNkSuTbEoA9CpCzNkSuTbEoAHuHeSpXzYgJtFbzopahwb

Note that a number turns into a string when it becomes $10$ or more, and remains a digit when it is $9$ or less.
Also, if digits are included, $|S_0| < |S_N|$ may hold, but it can be proven that $|S_N| \leq1300$ under these constraints.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。