lytqwq @ 2018-10-28 07:41:53
// luogu-judger-enable-o2
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int n,x=1;
cin>>n;
char a[n+1];
a[0]=getchar();
while((a[x]=getchar())!='\n')
{
for(int i=1;i<=n;i++)
{
if(a[x]!='z')
{
a[x]=a[x]+1;
}
else
{
a[x]='a';
}
}
x++;
}
for(int i=1;i<x;i++)
{
cout<<a[i];
}
return 0;
}
by Billy●Herrington @ 2018-10-28 08:46:48
a[x] = a[x] + 1
?
a[x] = 'a'
?
by lytqwq @ 2018-10-28 09:16:09
@违规用户名BfmB*EV0 第一个是向后移,第二个是从z到a。
by Jerrylee @ 2018-10-29 21:17:05
c++
二话不说
只贴代码
#include <bits/stdc++.h>
using namespace std;
int main()
{
string a;
int n,s,x;
cin>>n;
cin>>a;
s=a.size();
for(int i=0;i<=s-1;i++)
{
x=a[i]-'a';
x=(x+n)%26;
a[i]=x+'a';
cout<<a[i];
}
return 0;
}