/**
* 1.解题思路:顺序查看注释
*
* 2.参考博客:https://blog.csdn.net/liuchuo/article/details/52510582
**/
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
int main() {
//n个学生,m道题目
int n, m, temp, k;
scanf("%d%d", &n, &m);
//题目的选项插入存储在right[i](为集合类型)里面
vector<set<char>> right(m);
//题目的总分存储在total[i]
//wrongCnt[i]存储第i道题错误的人数
vector<int> total(m), wrongCnt(m);
for(int i = 0; i < m; i++) {
// 题目总分 选项个数 正确选项个数
scanf("%d%d%d", &total[i], &temp, &k);
for(int j = 0; j < k; j++) {
char c;
scanf(" %c", &c);
right[i].insert(c);
}
}
for(int i = 0; i < n; i++) {
int score = 0;
scanf("\n");
for(int j = 0; j < m; j++) {
//首尾没有空格
if(j != 0) scanf(" ");
//学生选中的选项个数
scanf("(%d", &k);
//学生的选项
set<char> st;
char c;
for(int l = 0; l < k; l++) {
scanf(" %c", &c);
st.insert(c);
}
scanf(")");
//比较st与right[i]是否相等
//如果相等说明该生答对了
//他的score += total[i](加上当前题目的总分)
if(st == right[j]) {
score += total[j];
} else {
//wrongCnt[i]++,表示第i道题新增一个错误的人
wrongCnt[j]++;
}
}
printf("%d\n", score);
}
//输出错得最多的题目的错误次数和编号
int maxWrongCnt = 0;
for(int i = 0; i < m; i++) {
if(wrongCnt[i] > maxWrongCnt) {
maxWrongCnt = wrongCnt[i];
}
}
if(maxWrongCnt == 0)
printf("Too simple");
else {
printf("%d", maxWrongCnt);
//题目按照输入的顺序从1开始编号
//若有并列,则按编号递增顺序输出
for(int i = 0; i < m; i++) {
if(wrongCnt[i] == maxWrongCnt) {
printf(" %d", i + 1);
}
}
}
return 0;
}
1058 选择题
最新推荐文章于 2021-02-03 10:36:32 发布