#include <iostream>
#include<string>
using namespace std;
typedef struct {
int score;//该题分数
int num;//选项个数
int right;//正确选项个数
string str="";//正确选项
}question[100];
int main()
{
int stu, que;
question a;
cin >> stu >> que;//学生人数和问题数
for (int i = 0;i < que;i++) {
cin >> a[i].score >> a[i].num >> a[i].right;
for (int j = 0;j < a[i].right;j++){
char c;
cin >> c;
a[i].str += c;//尾接法
}
}
int wrong[100] = { 0 };
for (int i = 0;i < stu;i++) {
int defen = 0;
scanf("
");//吃掉一个回车
for (int j = 0;j < que;j++) {
if (j != 0)scanf(" ");
int k;
string b = "";
scanf("(%d", &k);//用scanf()控制输入格式
for (int m = 0;m < k;m++) {
char c;
scanf(" %c", &c);
b = b + c;//尾接法
}
scanf(")");
if (b==a[j].str) {
defen += a[j].score;
}
else {
wrong[j]++;
}
}
cout << defen << endl;
}
//找出错的最多的题目的错误次数
int max = 0;
for (int i = 0;i < que;i++) {
if (wrong[i] > max) {
max = wrong[i];
}
}
if (max == 0) {
cout << "Too simple" << endl;
}
else {
cout << max;
for (int i = 0;i < que;i++) {
if (wrong[i] == max) {
cout << " " << i + 1;
}
}
}
return 0;
}
参考博客:https://blog.csdn.net/liuchuo/article/details/52510582