zltzlt 发表于 2020-1-20 13:05:19

洛谷题目 P1914

// https://www.luogu.com.cn/problem/P1914

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s, r = "", alpha = "abcdefghijklmnopqrstuvwxyz";
    char t;
    int n, i;
    cin >> n;
    cin >> s;

    for (i = 0; i < s.size(); i++)
    {
      t = ((char)s) + n;
      while (alpha.find(t) == string::npos)
            t -= 26;
      r += t;
    }
    cout << r;

    return 0;
}
页: [1]
查看完整版本: 洛谷题目 P1914