// PATn.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
class Question
{
public:
Question() = delete;
Question(unsigned &g, unsigned &c, unsigned &r, vector<char> &o) :grade(g), choice_number(c), right_number(r), options(o) {};
unsigned get_grade(vector<char> &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<char> options;
unsigned wrong = 0;
};
int main()
{
unsigned n, m;
cin >> n >> m;
vector<Question> data;
for (unsigned i = 0; i < m; ++i)
{
unsigned t1, t2, t3;
cin >> t1 >> t2 >> t3;
vector<char> 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<char> 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<<endl;
}
unsigned max_wrong = 0;
for (auto &r : data)
{
if (r.get_wrong_count() > 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<data.size(); ++j)
{
auto &r = data[j];
if (r.get_wrong_count() == max_wrong)
{
cout << (j + 1);
--tmp;
if (tmp != 0) //如果输出对象,才判断是否输出后置空格符!(对使用输入序号的数据,且切记不可sort(data)改变对象位置!)
cout << " ";
}
}
}
system("pause");
return 0;
}
1058
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 今天读了一遍易仁永澄的博客《别告诉我你懂时间管理》,从本质上搞清楚了时间管理是怎么回事。 以下用圣诞树模型做一个小...