dalao求救

P1914 小书童——凯撒密码

whhsteven @ 2019-07-14 18:23:03

dalao求救

以下是C++代码:

// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string src;
    string rst;
    getline(cin,src);
    n %= 26;
    for(int i=0;i<(int)src.length();i++)
    {
        if(src[i] + n > 'z') rst[i] = src[i] +  n - 26;
        else rst[i] = src[i] + n;
    }
    for(int i=0;i<(int)src.length();i++) cout << rst[i];
    return 0;
}

by QAQ______ @ 2023-07-21 21:27:51

考古


上一页 |