caiji12345 @ 2023-02-03 18:18:59
#include<bits/stdc++.h>
using namespace std;
int main ()
{
int n;
cin>>n;
char ch;
cin.get();
while((ch=getchar())!='\n'){
if(ch+n > 'z'){
ch = 'a'+(n-1-('z'-ch))%26;
}
else
ch += n;
cout<<ch;
}
return 0;
}
by MC00101 @ 2023-07-10 14:18:32
#include <bits/stdc++.h>
using namespace std;
int main(){
string a;
int n;
cin>>n;
cin>>a;
for(int i=0;i<=a.size()-1;i++){
a[i]=(a[i]-'a'+n)%26+'a';
}
cout<<a;
return 0;
}
给你 AC代码 互关一下