一直没法过,谁帮我康康

P1914 小书童——凯撒密码

Bramble_Marshall @ 2023-10-29 10:35:40

#include <bits/stdc++.h>

using namespace std;

int n;

int prints(std::string iut) {
    int m = iut.size();
    for (int i = 0; i < m; i++)
        printf("%c", iut[i]);
    return 0;
}

string input() {
    string ans = "";
    char s;
    s = getchar();
    do {
        s = getchar();
        ans += s;
    } while (s != EOF && s != '\n');
    return ans;
}

int main() {
    int num;
    string iut;
    scanf("%d", &n);
    iut = input();
    num = iut.size();
    for (int i = 0; i < num; i++)
        iut[i] = iut[i] < 'z' ? iut[i] + n : 'a'; 
    prints(iut);
    printf("\b");
    system("pause");
    return 0;
}

by zhangxisu @ 2023-12-11 21:42:11

你那个

system("pause");

评测机好像会超时


|