#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
struct question {
int num;//题目编号
int score;//题目分数
int choice_num;//题目所有选项个数
int wrong_time=0;//错误次数
char c[20];
};
question q[101];
int s[1001] = {0};//学生分数数组
char a[2000],k[200];
bool cmp(question x, question y){
if (x.wrong_time <=y.wrong_time)
return false;
else
return true;
}
int main()
{
bool flag = true,flag2=true;
int n, m;
cin >> n >> m;
for (int i = 0; i < m; i++) {
q[i].num = i+1;
cin >> q[i].score >> q[i].choice_num ;
char ch = getchar();
cin.getline(q[i].c, 20);
}
for (int i = 0; i < n; i++) {
int left = 0, right = 0,g=0;
cin.getline(a, 2000);
for (int j = 0; j < strlen(a); j++) {
if (a[j] == '(')
left++;
if (a[j] != '('&&a[j] != ')') {
k[g] = a[j];
g++;
}
if (a[j] == ')') {
j++;
k[g] = '\0';
if (strcmp(q[right].c, k) == 0)
s[i] = s[i] + q[right].score;
else {
q[right].wrong_time++;
flag = false;
}
g = 0;
k[0] = '\0';
right++;
}
}
}
for (int i = 0; i < n; i++)
cout << s[i] << endl;
if (flag) {
cout << "Too simple";
return 0;
}
sort(q, q + m, cmp);
cout << q[0].wrong_time<<" "<<q[0].num;
for (int i = 1; i < m; i++) {
if (q[i].wrong_time == q[0].wrong_time) {
cout << " " << q[i].num;
}
}
}
1058 选择题 (20分)详细代码 过程有点繁琐,但是整体思路很清晰
最新推荐文章于 2023-05-25 14:13:22 发布