1058

// PATn.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include
#include
#include
#include


using namespace std;

class Question
{
public:
    Question() = delete;
    Question(unsigned &g, unsigned &c, unsigned &r, vector &o) :grade(g), choice_number(c), right_number(r), options(o) {};
    unsigned get_grade(vector &s)
    {
        if (s == options)
            return grade;
        else
        {
            wrong += 1;
            return 0;
        }
            
    }
    unsigned get_wrong_count() const
    {
        return wrong;
    }
private:
    unsigned grade = 0;
    unsigned choice_number = 0;
    unsigned right_number = 0;
    vector options;

    unsigned wrong = 0;
};


int main()
{
    unsigned n, m;
    cin >> n >> m;

    vector data;
    for (unsigned i = 0; i < m; ++i)
    {
        unsigned t1, t2, t3;
        cin >> t1 >> t2 >> t3;
        vector tmp;
        char chr;
        for (unsigned j = 0; j < t3; ++j)
        {
            cin >> chr;
            tmp.push_back(chr);
        }
        data.push_back(Question(t1, t2, t3, tmp));
    }

    cin.ignore();
    for (unsigned i = 0; i < n; ++i)
    {
        string stu;
        getline(cin,stu);
        unsigned total_grade = 0;

        unsigned question_id = 0;
        unsigned the_first_number = 1;
        unsigned the_first_char = 3;
        for (unsigned j = 0; j < m; ++j)
        {
            vector answer;
            int k = stoi(string(1, stu[the_first_number]));
            for (int h = 0; h < k; ++h)
            {
                answer.push_back(stu[the_first_char]);
                the_first_char += 2;
            }
            total_grade += data[question_id].get_grade(answer);

            question_id += 1;
            the_first_number = the_first_char +2;
            the_first_char += (6 - 2);
    
        }
        cout << total_grade< max_wrong)
        {
            max_wrong = r.get_wrong_count();
        }
    }

    if (max_wrong == 0)
        cout << "Too simple";
    else
    {
        cout << max_wrong<<" ";
        
        unsigned tmp = 0;
        for (auto &r : data)
        {
            if (r.get_wrong_count() == max_wrong)
            {
                ++tmp;
            }
        }

        for (unsigned j = 0; j

你可能感兴趣的:(1058)