Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
75348 sh25_wangtaojie 加密的病历单 C++ 通过 0 MS 256 KB 732 2025-12-05 15:49:01

Tests(1/1):


#include <iostream> #include <string> #include <algorithm> using namespace std; string decrypt(const string& encrypted) { string decrypted = encrypted; int n = decrypted.size(); // 逆序存储 reverse(decrypted.begin(), decrypted.end()); // 循环右移3位并大小写反转 for (int i = 0; i < n; ++i) { char c = decrypted[i]; if (islower(c)) { decrypted[i] = toupper((c - 'a' + 3) % 26 + 'A'); } else { decrypted[i] = tolower((c - 'A' + 3) % 26 + 'a'); } } return decrypted; } int main() { string encrypted; cin >> encrypted; cout << decrypt(encrypted) << endl; return 0; }


测评信息: