hjsjhn @ 2017-08-06 21:00:58
为什么提示too long on line 0?
自己下载第一个数据测试和答案一样
#include<iostream>
#include<cstring>
#include<cstdio>
#define MAXN 10086
using namespace std;
char s[] = "zabcdefghijklmnopqrstuvwxy";
char sc[MAXN], c[MAXN];
int n;
int main()
{
scanf("%d", &n);
int k = 0;
cin>>c;
for(int i = 0;i <= strlen(c); i++)
for(int j = 0;j <= 25; j++) {
if(c[i] == s[j]) {
//cout<<c[i]<<" "<<s[j];
sc[k] = s[ (j + n)%26 ];
k++;
}
}//cout<<endl;
for(int i = 0;i <= k;i++)cout<<sc[i];
/*for(int i = 0;i <= strlen(c); i++) cout<<c[i]<<" ";
cout<<endl;
for(int j = 0;j <= 25; j++)cout<<s[j]<<" ";*/
return 0;
}