yang1812 @ 2023-11-06 21:22:09
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
string s;
cin>>n>>s;
for(int i = 0;i < s.length();i++){
if(s[i] + n <= 'z'){
s[i] += n;
}else{
s[i] = s[i] + n % 26 - 26;
}
}
cout<<s;
return 0;
}
by AKPC @ 2023-11-06 21:39:03
不要对 通过 124.67k 的题目提出质疑。
by Ehuo_ovo @ 2023-11-06 22:29:58
@yang1812
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
string s;
cin>>n>>s; n %= 26;
for(int i = 0;i < s.length();i++){
if(s[i] + n <= 'z'){
s[i] += n;
}
else{
s[i] = s[i] + n - 26;
}
}
cout<<s;
return 0;
}
hack数据:
100
abc
ans:tuv
wrong:]^_