恳求大佬救救蒟蒻 C语言 测试点5过不了

P1914 小书童——凯撒密码

Linjiang5 @ 2020-10-23 17:09:30

#include<stdio.h>
#define N 50
int main(void)
{
    char ch[N];
    int n;
    char ich[N];
    scanf("%d\n%s", &n, ich);
    for(int i = 0; ich[i] != '\0'; i++)
    {
        if(ich[i] + n <= 122)
        ch[i] = ich[i] + n;
        else
        ch[i] = 'a' + (n -1) - ('z' - ich[i]);
    }
    printf("%s", ch);
    return 0;
}

by FCB_forever @ 2020-10-23 22:46:58

您这个代码测试点1、2、5都过不了啊


by FCB_forever @ 2020-10-23 22:48:06

我用C++的测试的,sorry


|