题解
2024-11-23 09:25:50
发布于:浙江
26阅读
0回复
0点赞
#include<iostream>
#include<cstring>
using namespace std;
int main(){
char a[110];
int n;
cin>>n>>a;
for(int i=0;i<strlen(a);i++){
if(a[i]+n%26<='z'){
a[i]+=n%26;
cout<<a[i];
}else{
a[i]+=n%26;
a[i]-=26;
cout<<a[i];
}
}
return 0;
}
#include<iostream>
#include<cstring>
using namespace std;
int main(){
char a[110];
int n;
cin>>n>>a;
int b=strlen(a);
for(int i=0;i<b;i++){
if(a[i]+n%26<='z'){
a[i]+=n%26;
cout<<a[i];
}else{
a[i]+=n%26;
a[i]-=26;
cout<<a[i];
}
}
return 0;
}
这里空空如也
有帮助,赞一个