KobeBeanBryant @ 2020-12-25 18:38:19
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main(){
cin>>n;
cin>>s;
if(n==26){
cout<<s;
return 0;
}
for(int i=0;i<s.length();i++){
if(s[i]+n>122) {s[i]='a'+('z'-n)%26;continue;}
s[i]+=n;
continue;
}
cout<<s;
}
第四个点过不去
by FCB_1899 @ 2020-12-25 19:01:38
你看看把
by FCB_1899 @ 2020-12-25 19:03:14
我的AC代码
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main()
{
string s;
int n;
cin>>n;
cin>>s;
int l=s.size();
for(int i=0;i<l;i++)
s[i]=s[i]-'a';
for(int i=0;i<l;i++)
s[i]=(s[i]+n)%26;
for(int i=0;i<l;i++)
s[i]=s[i]+'a';
cout<<s;
return 0;
}
你看看
by FCB_1899 @ 2020-12-25 19:04:54
@ KobeBeanBryant
by KobeBeanBryant @ 2020-12-26 09:49:32
谢谢大佬