#include "testlib.h"
#include <string>
#include <cctype>

using namespace std;

// 标准答案（43 个字符，A=√，B=×）
const string STD_ANS = "BDCCBDDCBAADCABABAACCABBBACBAABDCDBDBCBDCAD";
const int N = 43;

// 每题分值（按题号 1~43 顺序）
const double SCORES[N] = {
    2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 1-15
    1, 1.5, 1.5,                    // 16-18
    3,3,3,                          // 19-21
    1.5,1.5,1.5,                    // 22-24
    3,3,3,                          // 25-27
    1.5,1.5,1.5,                    // 28-30
    3,3,3,                          // 31-33
    3,3,3,3,3,                      // 34-38
    3,3,3,3,3                       // 39-43
};

int main(int argc, char* argv[]) {
    setName("Special Judge for 43 multiple choice answers");
    registerTestlibCmd(argc, argv);

    // 读取选手输出中的所有 token，拼接成一个字符串
    string s;
    while (!ouf.seekEof()) {
        s += ouf.readToken();
    }

    // 提取所有字母并转为大写
    string ans_str;
    for (char c : s) {
        if (isalpha(c)) {
            ans_str += toupper(c);
        }
    }

    // 必须恰好 43 个字母
    if ((int)ans_str.length() != N) {
        quitf(_wa, "Expected %d letters, but found %d letters.", N, (int)ans_str.length());
    }

    // 逐题比较并累加得分
    double total_score = 0.0;
    for (int i = 0; i < N; i++) {
        if (ans_str[i] == STD_ANS[i]) {
            total_score += SCORES[i];
        }
    }

    // 返回评测结果
    if (total_score >= 100.0 - 1e-9) {
	    quitf(_ok, "All correct! Score: %.1f", total_score);
	} else {
	    quitp(total_score, "Score: %.1f / 100", total_score);
	}

    return 0;
}
