洪以濠 @ 2018-11-12 21:34:22
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#define dd long long
#define st string
#define bl bool
#define ch char
#define db double
using namespace std;
dd n;
st s,j;
void check(ch a,dd n)
{
ch b='a';
dd ans;
ans=a-96;
ans=ans+n;
ans=ans%26;
for(int i=1;i<=26;i++)
{
if(ans==i)
{
cout<<b;
return ;
}
b++;
}
}
int main()
{
cin>>n;
cin>>s;
for(int i=0;i<=s.length();i++)
{
check(s[i],n);
}
return 0;
}
by inoichi_lim @ 2018-11-26 17:10:35
...... 代码可以(for中的)改成这样:
st[i]-='a';st[i]+=n;st[i]%=26;
st[i]+='a';