60分,求大佬

P1914 小书童——凯撒密码

Sn_Eddy @ 2017-06-29 10:25:01

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    char s[100];
    cin>>n;
    if(n>26) n%=26;
    cin>>s;
    for (i=0;i<strlen(s);i++)
    {
        s[i]=s[i]+n;
        if(s[i]>'z') s[i]-=26;
    }
    for(i=0;i<strlen(s);i++)
        cout<<s[i];
    return 0;
}

by d3NtMDAw @ 2017-06-29 10:32:07

数组貌似开太小


|