m1895 @ 2021-04-10 17:13:32
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,o=0;
char a[100];
cin>>n;
cin>>a;
o=strlen(a);
for(int i=0;i<o;i++)
{
if(n<26)
{
if(a[i]!='z')
a[i]=a[i]+n;
else a[i]='a'-1+n;
}
if(n>26)
{
n=n%26;
if(a[i]!='z')
a[i]=a[i]+n;
else a[i]='a'-1+n;
}
}
cout<<a;
}
求帮助
by Almus @ 2021-04-10 17:35:09
没有把n=26的情况考虑进去哦
by Wobuxing @ 2021-04-23 20:32:37
其实不用判断,因为当