LKCoding @ 2020-04-12 22:24:31
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
int n;
cin>>n;
cin>>s;
for(int i=0;i<s.size();i++){
if(s[i]+n<=122){
s[i] = s[i]+n;
}
else{
s[i] = 96+(s[i]+n-122)%26;
}
}
cout<<s<<endl;
return 0;
}
by metaphysis @ 2020-04-13 07:11:05
@LKCoding
提示:
s[i] = 96+(s[i]+n-122)%26
如果“(s[i]+n-122)”恰好等于 26 呢?