qwertyuiop111_ @ 2024-07-18 09:15:41
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
string b;
cin>>b;
for(int i=0;i<b.size();i++)
{
if (b[i]=='z') b[i]=b[i]-27+a;
else b[i]+=a;
}
cout<<b;
return 0;
}
by Kavin_0409 @ 2024-07-18 09:23:26
a~z->a是一个循环,用mod
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
string b;
cin>>b;
for(int i=0;i<b.size();i++)
{
b[i]=(b[i]-'a'+26+n)%26+'a';
}
cout<<b;
return 0;
}
by qwertyuiop111_ @ 2024-07-18 09:34:07
@Kavin_0409 已过,完结