sevenwaters @ 2019-02-22 11:10:52
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n, i;
char a[50] = { 0 }, b[50] = { 0 };
scanf("%d", &n);
getchar();
for (i = 0;i<50;i++)
{
a[i] = getchar();
if (a[i] == '\n')
{
break;
}
}
for (i = 0;i<50;i++)
{
if (a[i]>96 && a[i]<123)
{
if (a[i] + n % 26 > 122)
{
b[i] = a[i] + n % 26 - 'z' + 96;
}
else if (a[i] + n % 26 < 123)
{
b[i] = a[i] + n % 26;
}
}
else
{
b[i] = a[i];
}
}
for (i = 0;i<50;i++)
{
if (b[i]>96 && b[i]<123)
{
printf("%c", b[i]);
}
}
system("pause");
return(0);
}
by sevenwaters @ 2019-02-22 13:21:22
@klssxbc0002 我试一下求长,一会儿反馈!谢过大佬
by Lovable_Wind @ 2019-02-22 13:22:20
@sevenwaters 啦,我也就专打水题啦
by sevenwaters @ 2019-02-22 13:24:16
@klssxbc0002 但我就不明白为什么样例通过,测试全wa。
by sevenwaters @ 2019-02-22 13:24:38
@klssxbc0002 弄得我怀疑人生
by Lovable_Wind @ 2019-02-22 13:26:53
@sevenwaters 你等一下,我再看看
by Lovable_Wind @ 2019-02-22 13:28:00
没显示你提交了呀
by Lovable_Wind @ 2019-02-22 13:29:49
n=a.size();
n-=1;
for (i=1;i<=n;i++)
应该不会WA啊
by sevenwaters @ 2019-02-22 13:33:28
@klssxbc0002 a b开成1000的通过了,真是洛式解题。
by houfuhao @ 2019-06-15 19:38:13
@sevenwaters 我的代码也是全WA,但是我测试都是对的
by houfuhao @ 2019-06-15 19:40:31
@sevenwaters 可能是因为getchar的问题,在咱们用的时候会考虑'\n',但是这里测试的时候我就不知道了