Run ID:145482
提交时间:2026-01-25 15:43:37
#include<bits/stdc++.h> using namespace std; int main() { string password; cin >> password; // 第一个字符:第一个数字对应的大写字母 (0->A, 1->B, ..., 9->J) char first = password[0] - '0' + 'A'; // 第二个字符:第二个数字的奇偶性处理 int second_digit = password[1] - '0'; char second; if (second_digit % 2 == 0) { second = (second_digit / 2) + '0'; } else { second = second_digit + '0'; } // 第三个字符:前三个数字相加的个位数字 int sum_first_three = (password[0] - '0') + (password[1] - '0') + (password[2] - '0'); char third = (sum_first_three % 10) + '0'; // 第四个字符:第四个数字本身 char fourth = password[3]; // 第五个字符:'le'的ASCII相加再加上第五位密码数字的十位 int le_ascii_sum = 'l' + 'e'; // 'l' = 108, 'e' = 101 int fifth_digit = password[4] - '0'; int fifth = (le_ascii_sum + fifth_digit) / 10; // 十位数 char fifth_char = fifth + '0'; // 第六个字符:全部六个数字相加的个位 int total_sum = 0; for (int i = 0; i < 6; i++) { total_sum += password[i] - '0'; } char sixth = (total_sum % 10) + '0'; cout << first << second << third << fourth << fifth_char << sixth << endl;; return 0; }