60求解

P1914 小书童——凯撒密码

Chh0726 @ 2024-07-15 17:31:42

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int n,i,j;
    cin>>n;
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        for(j=1;j<=n;j++)
        {
            s[i]++;
            if(s[i]=='z')
            s[i]='a';
        }
    }
    cout<<s;
    return 0;
}

by Liyanxi1028 @ 2024-07-15 17:34:10

应是 if(s[i]>'z')


|