liyuxuanzzz @ 2020-02-13 00:00:07
#include<stdio.h>
int main()
{
int n,i;
//freopen("121.txt","r",stdin);
scanf("%d",&n);
getchar();
char a[60];
int b[60];
while(scanf("%c",&a[i]) != EOF )
{
b[i] = n + a[i] - 48-'0'; // 把a-z转化为1-26
b[i] = b[i] % 26;
if(b[i] == 0) printf("%c",'z');
else printf("%c",b[i] + 48 + '0');
}
return 0;
}
by 茅山小榉榉 @ 2020-02-13 15:33:10
你试试普通的结束,直接scanf("%s",a); 他可能没有用EOF结束
by only76 @ 2020-02-15 14:51:27
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<map>
using namespace std;//97:a 65:A
string b;
char c,x[1000];
int a,cdu,i,j,k,x2[26],maxn,d;
int main()
{
cin>>a;
cin>>b;
cdu=b.size();
for(i=0; i<cdu; i++)
{
x[i]=(b[i]-'a'+a) % 26 +'a';
}
for(k=0; k<cdu; k++)
{
cout<<x[k];
}
}