#include <iostream>
using namespace std;
const int M = 110, N = 1010;
struct{
double full_grade, options, correct_options;
char op[10];
}ques[M];
double grade[N];
int cnt[M][10]; // 第i道题的第j个选项
int main ()
{
int n, m;
cin >> n >> m;
for(int i = 1 ; i <= m ; i ++ )
{
cin >> ques[i].full_grade >> ques[i].options >> ques[i].correct_options;
for(int j = 1 ; j <= ques[i].correct_options ; j ++ ) cin >> ques[i].op[j];
}
int flag_all = 1;
for(int i = 1 ; i <= n ; i ++ )
for(int j = 1 ; j <= m ; j ++ )
{
char c;
scanf(" %c", &c);
int ans_num;
scanf(" %d", &ans_num);
char put[10];
for(int k = 1 ; k <= ans_num ; k ++ ) scanf(" %c", &put[k]);
cin >> c;
int flag = 1;
for(int k = 1 ; k <= ans_num ; k ++ ) // 选错
{
int mask = 0;
for(int r = 1 ; r <= ques[j].correct_options ; r ++ )
{
if(put[k] == ques[j].op[r])
{
mask = 1;
break;
}
}
if(!mask) // 标准答案里没有的
{
int t = put[k] - 'a';
cnt[j][t] ++ ;
flag = 0;
flag_all = 0;
}
}
for(int k = 1 ; k <= ques[j].correct_options ; k ++ ) // 选漏
{
int mask = 0;
for(int r = 1 ; r <= ans_num ; r ++ )
if(ques[j].op[k] == put[r])
{
mask = 1;
break;
}
if(!mask) // 没有选到的标准答案
{
int t = ques[j].op[k] - 'a';
cnt[j][t] ++ ;
flag_all = 0;
}
}
if(!flag) continue;
if(ans_num < ques[j].correct_options) grade[i] += ques[j].full_grade / 2;
else grade[i] += ques[j].full_grade;
}
for(int i = 1 ; i <= n ; i ++ ) printf("%.1lf\n", grade[i]);
if(flag_all) {puts("Too simple"); return 0;} // 这个要放到前面来不然的话,在mmax == 0的时候会wa
int mmax = 0;
for(int i = 1 ; i <= m ; i ++ )
for(int j = 0 ; j < 10 ; j ++ )
mmax = max(mmax, cnt[i][j]);
for(int i = 1 ; i <= m ; i ++ )
for(int j = 0 ; j < 10 ; j ++ )
if(cnt[i][j] == mmax)
cout << mmax << " " << i << '-' << char(j + 'a') << endl;
return 0;
}
PAT_B_1073_C++(20分)
猜你喜欢
转载自blog.csdn.net/qq_43511405/article/details/107429419
今日推荐
周排行