luogufather @ 2022-08-19 21:51:28
#include<bits/stdc++.h>
using namespace std;
int n,m,a[11],b[11],x[114514];
string in;
int main(){
cin>>n>>in;
m=in.length();
for(int i=0;i<m;i++){
if((in[i]+n)<=122)
in[i]=in[i]+n;
else
in[i]=n-121+in[i]+97;
}
cout<<in;
return 0;
}
输入: 26 qwertyuiopasdfghjklzxcvbnm 正确输出: qwertyuiopasdfghjklzxcvbnm 我的输出: sygtv{wkqrcufhijlmn|zexdpo
by Ricky2008 @ 2022-08-19 21:54:13
给你康康一个更简单的:
#include<bits/stdc++.h>
using namespace std;
int main(){
string a;
int b;
cin>>b>>a;
for(int i=0;i<a.size();i++){
for(int j=1;j<=b;j++){
a[i]++;
if(a[i]>'z') a[i]='a';
}
}
cout<<a;
return 0;
}
你懂了吗?
by Always_Remember_It @ 2022-08-19 22:02:51
下次发这贴的时候记得叫上Michael
by 荒泷一斗 @ 2022-08-22 16:39:33
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
char s[60];
scanf("%d %s",&n,&s);
for(int i=0;s[i];i++)
{putchar((s[i]-'a'+n)%26+'a')}
return 0;
简单吗?不喜勿喷
by 荒泷一斗 @ 2022-08-22 16:41:58
@arageg_bzn_0228
compile error ,hhhh
by luogufather @ 2022-08-22 19:24:20
@Ricky2008 OK,谢谢大佬
by Ricky2008 @ 2022-08-22 19:26:57
@luogufather 嘻嘻