3,4点过不去,考虑了特判,双重循环做法

P1914 小书童——凯撒密码

__er @ 2022-04-27 12:22:12

60 Code:

#include <bits/stdc++.h>
using namespace std;
string a;
long long i, n, j;

int main() {
    cin >> n;
    cin >> a;
    for (i = 0; i < a.length(); i++) {
        for (j = 1; j <= n; j++) {
            if (a[i] == 'z') {
                a[i] = 'a';
            }
            a[i]++;
        }
    }
    cout << a;
    return 0;
}

by __er @ 2022-04-27 13:23:45

@暗夜黑黑黑手 谢谢


上一页 |