初墨 @ 2018-12-11 20:43:49
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a[1003];
int i,j,n;
cin>>n>>a;
j=strlen(a);
if(n>26)
{
n=n%26;
}
for(i=0;i<j;i++)
{
a[i]+=n;
if(a[i]>'z')
{
a[i]-=122;
a[i]+=96;
}
cout<<a[i];
}
return 0;
}
by 初墨 @ 2018-12-11 20:44:07
求助大佬
by 稻荷神御馔津 @ 2018-12-11 20:47:44
using namespace std; char in[110]; int main() { int n, j; scanf("%d%s", &n,&in); for(j=0;in[j]!='\0';j++) { putchar((in[j]-'a'+n)%26+'a'); } }
by 稻荷神御馔津 @ 2018-12-11 20:50:21
#include "bits/stdc++.h"
using namespace std;
char in[110];
int main()
{
int n, j;
scanf("%d%s", &n,&in);
for(j = 0; in[j] != '\0'; j++)
{
putchar((in[j]-'a'+n)%26+'a');
}
}
by 初墨 @ 2018-12-12 10:45:38
@cold 谢了