chicken37210 @ 2023-08-03 10:07:56
#include<bits/stdc++.h>
using namespace std;
int n;
char s[60];
int main(){
cin >> n;
scanf("%s",s + 1);
int len = strlen(s + 1);
for(int i = 1;i <= len;i++){
s[i] = s[i] + n;
if(s[i] >= 122){
int t = s[i] - 122;
s[i] = 97 + t;
}
cout << s[i];
}
return 0;
}
by CcmCyh11140810 @ 2023-08-03 10:19:12
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,la,b[200];
char a[200];
cin>>n;
cin>>a;
la=strlen(a);
for(i=0;i<la;i++)
{
b[i]=a[i];
}
for(i=0;i<la;i++)
{
b[i]=b[i]+n;
}
for(i=0;i<la;i++)
{
if(b[i]>122)
{
b[i]=b[i]%122+96;
}
}
for(int i=0;i<la;i++)
{
a[i]=b[i];
cout<<a[i];
}
}
by chicken37210 @ 2023-08-04 09:59:39
@CcmCyh11140810 谢谢了