PAT 乙级 1073 多选题常见计分法 (20分)

我的个人网站 Cheese的个人主页icon-default.png?t=M4ADhttp://www.cheese.ren/

博客来源 PAT 乙级 1073 多选题常见计分法-Cheese的个人博客PAT 乙级 1073 多选题常见计分法http://blog.cheese.ren/93

欢迎交换友链 :-)


#include <bits/stdc++.h>

using namespace std;

struct Problem {
    int score, option_num, right_option_num, wrong_options_num[5], options[5];
};

int main() {
    int n, m, wrong_max=0;
    Problem p[1001];
    map<char, int> mapp;
    mapp['a'] = 0;
    mapp['b'] = 1;
    mapp['c'] = 2;
    mapp['d'] = 3;
    mapp['e'] = 4;

    cin >> n >> m;
    for (int i=0; i<m; i++) {
        cin >> p[i].score >> p[i].option_num >> p[i].right_option_num;
        for (int l=0; l<p[i].right_option_num; l++) {
            char c;
            cin >> c;
            p[i].options[mapp[c]] = 1;
        }
    }
    for (int i=0; i<n; i++) {
        double sum=0;
        for (int l=0; l<m; l++) {
            char c;
            //  flag 0完全正确,1部分正确,2错误
            int num, flag=0, o[5]={0, 0, 0, 0, 0};
            cin >> c >> num;
            for (int j=0; j<num; j++) {
                cin >> c;
                o[mapp[c]] = 1;
            }
            cin >> c;
            for (int j=0; j<5; j++) {
                //  学生少选
                if (o[j] < p[l].options[j]) {
                    if (flag == 0) {
                        flag = 1;
                    }
                    p[l].wrong_options_num[j]++;
                    if (wrong_max < p[l].wrong_options_num[j]) {
                        wrong_max = p[l].wrong_options_num[j];
                    }
                }
                //  学生错选
                if (o[j] > p[l].options[j]) {
                    flag = 2;
                    p[l].wrong_options_num[j]++;
                    if (wrong_max < p[l].wrong_options_num[j]) {
                        wrong_max = p[l].wrong_options_num[j];
                    }
                }
            }
            //  学生什么都不选
            if (num == 0) {
                flag = 2;
            }
            if (flag == 0) {
                sum += p[l].score;
            }
            else if (flag == 1) {
                sum += (double)p[l].score / 2;
            }
        }
        cout << fixed << setprecision(1) << sum << endl;
    }
    if (wrong_max == 0) {
        cout << "Too simple" << endl;
    }
    else {
        for (int i=0; i<m; i++) {
            for (int l=0; l<5; l++) {
                if (wrong_max == p[i].wrong_options_num[l]) {
                    cout << wrong_max << " " << i+1 << "-" << char('a'+l) << endl;
                }
            }
        }
    }

    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值