| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 145478 | 徐毅然 | 11加密规则 | C++ | Compile Error | 0 MS | 0 KB | 1328 | 2026-01-25 15:43:08 |
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;
Main.cc:1:1: error: 'string' does not name a type
string password;
^
Main.cc:2:5: error: 'cin' does not name a type
cin >> password;
^
Main.cc:5:18: error: 'password' was not declared in this scope
char first = password[0] - '0' + 'A';
^
Main.cc:8:24: error: 'password' was not declared in this scope
int second_digit = password[1] - '0';
^
Main.cc:10:5: error: expected unqualified-id before 'if'
if (second_digit % 2 == 0) {
^
Main.cc:12:7: error: expected unqualified-id before 'else'
} else {
^
Main.cc:17:28: error: 'password' was not declared in this scope
int sum_first_three = (password[0] - '0') + (password[1] - '0') + (password[2] - '0');
^
Main.cc:17:50: error: 'password' was not declared in this scope
int sum_first_three = (password[0] - '0') + (password[1] - '0') + (password[2] - '0');
^
Main.cc:17:72: error: 'password' was not declared in this scope
int sum_first_three = (password[0] - '0') + (password[1] - '0') + (password[2] - '0');
^
Main.cc:21:19: error: 'password' was not declared in this scope
char fourth = password[3];
^
Main.cc:25:23: error: 'password' was not declared in this scope
int fifth_digit = password[4] - '0';
^
Main.cc:31:5: error: expected unqualified-id before 'for'
for (int i = 0; i < 6; i++) {
^
Main.cc:31:21: error: 'i' does not name a type
for (int i = 0; i < 6; i++) {
^
Main.cc:31:28: error: 'i' does not name a type
for (int i = 0; i < 6; i++) {
^
Main.cc:36:5: error: 'cout' does not name a type
cout << first << second << third << fourth << fifth_char << sixth << endl;
^