#include <iostream> using namespace std; int main() { int num; // 读取输入的四位数 cin >> num; // 分别取出四位数的每一位 int digit1 = (num / 1000 + 5) % 10; int digit2 = (num / 100 % 10 + 5) % 10; int digit3 = (num / 10 % 10 + 5) % 10; int digit4 = (num % 10 + 5) % 10; // 颠倒得到的新数 int encryptedNum = digit4 * 1000 + digit3 * 100 + digit2 * 10 + digit1; // 输出加密后的结果 cout << encryptedNum << endl; return 0; } /************************************************************** Problem: 1109 User: linzihang Language: C++ Result: Accepted Time:9 ms Memory:2072 kb ****************************************************************/