怎么超时了呢?

P1914 小书童——凯撒密码

SAZZM @ 2016-08-16 12:52:25

#include<stdio.h>
int main()
{
    int n;
    char ch;
    scanf("%d \n",&n);
    n=n%26;
    while(1)
    {
        scanf("%c",&ch);
        if(ch!='\n')
        {
            ch=ch+n;
            if(ch>'z')
                ch=ch-'z'+'a'-1;
            printf("%c",ch);
            continue;
        }
        else
            break;
    }
    printf("\n");
}

by wawcac @ 2016-08-16 14:45:50

return 0!!!

scanf读不到回车,用getchar吧


|