20分!

P1914 小书童——凯撒密码

蕙心纨质 @ 2015-12-03 00:00:54

#include<stdio.h>
#include<string.h>
int main()
{
    int n,Long,i;
    char a[100];
    int b[100];
    scanf("%d",&n);
    scanf("%s",&a);
    Long = strlen(a);
    n = n%26;
    for(i = 0;i<Long;i++)
    { 
        b[i] = (int)a[i] + n;
        if((b[i]>122))
        {
            b[i] = b[i]-26;
         } 
    }
    for(i = 0;i < Long;i++)
    {
        printf("%c",b[i]);
    }
    return 0;
}

|