NOI_O2 @ 2024-04-08 16:41:28
样例过了
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main()
{
cin>>n;
cin>>s;
for(int i=0;i<=s.size();++i)
{
if(s[i]+n<='z')
{
s[i]+=n;
cout<<s<<"\n";
}
else
{
int t=n-('z'-s[i]);
s[i]='a'+t;
cout<<s<<"\n";
}
}
cout<<s;
return 0;
}
by xuekaiyang @ 2024-04-08 17:02:35
#include <stdio.h>//一个不平常的头代码
int main()
{
char in[100];
int n, j;
scanf("%d%s", &n, in);
for(j = 0; in[j] != '\0'; j++)
putchar((in[j]-'a'+n)%26+'a');
}
by malinhao45 @ 2024-04-25 21:09:51
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main()
{
cin>>n;
cin>>s;
for(int i=0;i<=s.size();++i)
{
if(s[i]+n<='z')
{
s[i]+=n;
}
else
{
int t=(s[i]+n)%'z';
s[i]='a'+t-1;
}
}
cout<<s;
return 0;
}
by aleavf @ 2024-05-15 20:51:13
#include<iostream>
#include<string>
using namespace std;
int n;
string s;
int main(){
cin >> n >> s;
for(int i = 0;i < s.size();i++){
if(s[i] + n > 122){
s[i] -= 26;
}
s[i] += n;
}
cout << s;
return 0;
}