向大佬求助,测试点一个都没过!!

P1914 小书童——凯撒密码

muhit17 @ 2020-01-03 14:32:58

#include<stdio.h>
int main(void)
{
    int n,i=0,p,t,mid1,mid2,mid3;
    char input[51];
    char output[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    scanf("%d",&n);
    getchar();
    gets(input);

    mid2=n;
    while(input[i]!='\0')
    i++; 

    for(p=0;p<i;p++)
    {
        for(t=0;t<26;t++)
        {
            if(input[p]==output[t])
            {
            mid1=t;
            break;
            }
            else
            continue;
        }
        while(mid2>26) 
        mid2=mid2-26;

        if(mid1+mid2>=26)
        {
        mid3=mid1+mid2-26;
        printf("%c",output[mid3]);
        }
        else
        printf("%c",output[mid1+mid2]);
    }
    return 0;
}

|