第一个 `for` 循环内部应该为:
```cpp
a[i] += n;
if(a[i] > 'z') a[i] -= 26;
```
$n \le 26$,所以你这判了个寂寞
~~能 80 分说明数据太水了(~~
by No_Rest @ 2023-12-20 22:41:23
```cpp
for(int i=0; i<a.length(); i++){
a[i]+=n-26;
if(a[i]<'a') a[i]+=26;
}
```
by SuperAlex4 @ 2023-12-20 23:33:07
输入:
```
1
xyz
```
错误答案:
```
yz{
```
预期:
```
yza
```
错误原因:
x与y两个字符没问题,z字符 + 1 就是 {,所以,12 - 14行应改成:
```cpp
if (n + a[i] > 'z')
a[i] = a[i] - 26 + n;
else
a[i] = a[i] + n;
```
by lichenxi108 @ 2023-12-21 12:27:19
@[ldf1208](/user/550821) 哥你这样改出来也错的呀
by ljx2004_cn @ 2023-12-26 17:53:23