IaLWH @ 2021-07-12 12:50:22
奇奇怪怪
#include<cstdio>
#include<cstring>
int main(){
char a[51];
int n,i;
scanf("%d%s",&n,a);
for(i=0;i<strlen(a);i++){
a[i]+=n;
while(a[i]>'z')
a[i]-='z';
}
printf("%s",a);
return 0;
}
样例过了,#3#4
by qnqfff @ 2021-07-12 13:37:56
#include<cstdio>
#include<cstring>
int main(){
char a[51];
int n,i;
scanf("%d%s",&n,a);
for(int i=0;i<strlen(a);++i){
for(int j=1;j<=n;++j){
a[i]++;
if(a[i]>'z')
a[i]='a';
}
}
printf("%s",a);
return 0;
}
☺
by 阿丑 @ 2021-07-12 13:40:03
@PluckDuck
while(a[i]>'z')
a[i]-='z';
这句话是错的。因为 a
~z
对应的并不是
hack:
1
z