编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5018 #1030. 选择题 Compile Error 0 0 ms 0 K C++ 17 (Clang) / 1.1 K t330026199 2024-02-25 15:00:40
显示原始代码
#include <iostream>
using namespace std;
int N;
const int manx = 10000 + 5;
char z_ans[manx][6];
char t_ans[manx][6];
int main() {
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> z_ans[i];
        cin >> t_ans[i];
    }
    // for(int i=1;i<=N;i++)
    // cout << z_ans[i] <<endl<< t_ans[i] << endl;
    int score = 0;
    for (int i = 1; i <= N; i++) {
        if (strlen(t_ans[i]) == 1) {
            if (z_ans[i][1] == t_ans[i][1])
                score += 3;
        } else {
            if (strlen(z_ans[i]) > strlen(t_ans[i]))
                score += 0;
            else {
                int mark = 0;
                for (int j = 0; j < strlen(z_ans[i]); j++) {
                    for (int k = 0; k < strlen(t_ans[i]); k++) {
                        if (z_ans[i][j] == t_ans[i][k]) {
                            // cout << z_ans[i][j] << endl << t_ans[i][k]<<endl;
                            mark++;
                            break;
                        }
                    }
                }
                //	cout  << mark << endl;
                if (mark == strlen(z_ans[i]) && mark == strlen(t_ans[i]))
                    score += 5;
                else if (mark == strlen(z_ans[i]))
                    score += 2;

                // cout << z_ans[1][0]<<z_ans[1][1]<<z_ans[1][2]<<z_ans[1][3];
                // cout << t_ans[1][0] << t_ans[1][1];
            }
        }
    }
    cout << score << endl;
    return 0;
}

编译信息

/sandbox/1/a.cpp:17:7: error: use of undeclared identifier 'strlen'
                if (strlen(t_ans[i]) == 1)
                    ^
/sandbox/1/a.cpp:23:8: error: use of undeclared identifier 'strlen'
                        if (strlen(z_ans[i]) > strlen(t_ans[i]))
                            ^
/sandbox/1/a.cpp:23:27: error: use of undeclared identifier 'strlen'
                        if (strlen(z_ans[i]) > strlen(t_ans[i]))
                                               ^
/sandbox/1/a.cpp:27:25: error: use of undeclared identifier 'strlen'
                                for (int j = 0; j < strlen(z_ans[i]); j++) {
                                                    ^
/sandbox/1/a.cpp:28:26: error: use of undeclared identifier 'strlen'
                                        for (int k = 0; k < strlen(t_ans[i]); k++) {
                                                            ^
/sandbox/1/a.cpp:39:17: error: use of undeclared identifier 'strlen'
                                if (mark == strlen(z_ans[i]) && mark == strlen(t_ans[i]))
                                            ^
/sandbox/1/a.cpp:39:45: error: use of undeclared identifier 'strlen'
                                if (mark == strlen(z_ans[i]) && mark == strlen(t_ans[i]))
                                                                        ^
/sandbox/1/a.cpp:41:22: error: use of undeclared identifier 'strlen'
                                else if (mark == strlen(z_ans[i]))
                                                 ^
8 errors generated.