# 1058 multiple choice questions (20 points)

Correcting multiple-choice questions is more troublesome. Please write a program to help the teacher correct multiple-choice questions and point out which question is wrong most.

### Input format:

Input gives two positive integers N (≤) on the first line 1000) and M (≤ 100), which are the number of students and the number of multiple topics. Then, in line M, the full score of a question (a positive integer not exceeding 5), the number of options (a positive integer not less than 2 and not more than 5), the number of correct options (a positive integer not exceeding the number of options), and all correct options are given in sequence in each line. Note that the options of each question are arranged in order starting from the English letter A. Items are separated by 1 space. In the last N lines, each line gives a student's answer, and the answer format of each question is (number of selected options, option 1...) are given in the order of topics. Note: the questions ensure that students' answers are legal, that is, there is no case where the number of selected options exceeds the actual number of options.

### Output format:

Each student's score is given in the order of input, and each score occupies one line. Note that when judging the question, you can get the score of the question only if you choose all the correct ones. The last line outputs the error times and number of the most wrong topics (the topics are numbered from 1 in the order of input). If there is juxtaposition, it is output in ascending order. Numbers shall be separated by spaces, and there shall be no extra spaces at the beginning and end of the line. If all the questions are correct, output them on the last line Too simple.

### Input example:

3 4 3 4 2 a c 2 5 1 b 5 3 2 b c 1 5 4 a b d e (2 a c) (2 b d) (2 a c) (3 a b e) (2 a c) (1 b) (2 a b) (4 a b d e) (2 b d) (1 e) (2 b c) (4 a b c d)

No blank lines at the end

### Output example:

3 6 5 2 2 3 4

### Problem solving idea: the correct answer information of the problem needs to be stored in advance, At the same time, an array needs to be opened to record the number of errors in each question; Because there are many characters such as input space-time lattice and brackets, it is best to write code and debug here to ensure that the information of the topic can be correctly input and recorded; Finally, it only needs to traverse the array twice to find the maximum number of errors (and juxtaposition). The complexity is linear, and the complexity of calling sort is, so there is no need to sort. The code is as follows: (the running time is 23ms)

#include <iostream> #include <vector> #include <cstring> using namespace std; int error[100]; // Record the number of errors in the topic int judge(char a[],char stand[],int qus_no) // Problem determination function, qus_no is the question number { if (strcmp(stand,a)==0) return 1; else error[qus_no]++; return 0; } int main() { int n,m; cin>>n>>m; vector <int> score(m); //Score of the topic char ans[m][6],temp[6]; int t,k; for (int i=0;i<m;i++) { scanf("%d%d%d",&score[i],&t,&k); getchar(); for (int j=0;j<k;j++) { scanf("%c",&ans[i][j]); getchar(); } ans[i][k]=0; } int grade;char c; for (int i=0;i<n;i++) { grade=0; for (int j=0;j<m;j++) { scanf("(%d",&k); for (int p=0;p<k;p++) { getchar(); scanf("%c",&temp[p]); } scanf(")"); getchar(); temp[k]=0; // printf("##%s %s##\n",temp,ans[j]); // Whether the debugging problem information is correctly recorded if (judge(temp,ans[j],j)==1) grade+=score[j]; } printf("%d\n",grade); } int maxi=0; for (int i=1;i<m;i++) { if ( error[i]>error[maxi] ) maxi=i; } if (error[maxi]==0) { printf("Too simple"); return 0; } printf("%d %d",error[maxi],maxi+1); for (int i=0;i<m;i++) { if (i==maxi) continue; if (error[i]==error[maxi]) printf(" %d",i+1); //Number of parallel errors processed } printf("\n"); return 0; }

# Common scoring method for 1073 multiple choice questions (20 points)

Correcting multiple-choice questions is a troublesome thing. There are many different scoring methods. One of the most common scoring methods is: if the examinee selects some correct options and does not select any wrong options, he will get a 50% score; If the candidate chooses any of the wrong options, he will not be able to score. Please write a program to help the teacher correct multiple-choice questions and point out which of the questions has the most wrong choices.

### Input format:

Input two positive integers N (≤ 1000) and M (≤ 100) are given in the first line, which are the number of students and the number of multiple topics respectively. Then, in line M, the full score of a question (a positive integer not exceeding 5), the number of options (a positive integer not less than 2 and not more than 5), the number of correct options (a positive integer not exceeding the number of options), and all correct options are given in sequence in each line. Note that the options of each question are arranged in order starting from the English letter A. Items are separated by 1 space. In the last N lines, each line gives a student's answer, and the answer format of each question is (number of selected options, option 1...) are given in the order of topics. Note: the questions ensure that students' answers are legal, that is, there is no case where the number of selected options exceeds the actual number of options.

### Output format:

The scores of each student are given in the order of input. Each score occupies one line and outputs one decimal place. Finally, the information of the most wrong topic option is output in the format of: number of errors, topic number (topics are numbered from 1 in the input order) - option number. If there is juxtaposition, one option for each line will be output in ascending order of topic number; If they are juxtaposed again, they will be output in ascending order of option number. There must be no extra spaces at the beginning and end of the line. If all the questions are correct, output them on the last line Too simple.

### Input example 1:

3 4 3 4 2 a c 2 5 1 b 5 3 2 b c 1 5 4 a b d e (2 a c) (3 b d e) (2 a c) (3 a b e) (2 a c) (1 b) (2 a b) (4 a b d e) (2 b d) (1 e) (1 c) (4 a b c d)

No blank lines at the end

### Output example 1:

3.5 6.0 2.5 2 2-e 2 3-a 2 3-b

No blank lines at the end

### Input example 2:

2 2 3 4 2 a c 2 5 1 b (2 a c) (1 b) (2 a c) (1 b)

No blank lines at the end

### Output example 2:

5.0 5.0 Too simple

No blank lines at the end

Problem solving ideas: pay attention to distinguish the previous problem and several points of attention; Here, half of the scores are obtained by missing selection, and no score is obtained by multiple selection or wrong selection. The scores should be stored in double type; The last line outputs the most wrong option information, and its question number and number of errors are output at the same time, focusing on the option information. Moreover, the more wrong options and the less correct options selected here should be counted. For example, in question 2 of example 1, the correct option b is less selected twice, and the wrong option a is more selected twice, both should count, because there are at most 5 options, For 100 questions, directly open a two-dimensional array to record the error information of the options (not very large); Finally, it also traverses to find the maximum output. The probability of measuring point error is that the above problems are not fully considered. The code is as follows: (the running time is 27ms)

#include <iostream> #include <vector> #include <cstring> using namespace std; int error[100][5]={0}; //Log error messages for options int judge(char a[],char stand[],int qus_no) { if (strcmp(a,stand)==0) return 2; else { int len=strlen(a),flag=1; for (int i=0;i<len;i++) { if ( strchr(stand,a[i])==NULL ) { flag=0; error[qus_no][a[i]-'a']++; } } len=strlen(stand); for (int i=0;i<len;i++) { if (strchr(a,stand[i])==NULL) { error[qus_no][stand[i]-'a']++; } } if (flag) return 1; else return 0; } } int main() { int n,m; cin>>n>>m; vector <int> score(m); char ans[m][6],temp[6]; int t,k; for (int i=0;i<m;i++) { scanf("%d%d%d",&score[i],&t,&k); getchar(); for (int j=0;j<k;j++) { scanf("%c",&ans[i][j]); getchar(); } ans[i][k]=0; } double grade;char c; for (int i=0;i<n;i++) { grade=0; for (int j=0;j<m;j++) { scanf("(%d",&k); for (int p=0;p<k;p++) { getchar(); scanf("%c",&temp[p]); } scanf(")"); getchar(); temp[k]=0; // printf("##%s %s##\n",temp,ans[j]); // Whether the debugging input information is recorded correctly //Score for each question int flag=judge(temp,ans[j],j); if (flag==2) grade+=1.0*score[j]; else if (flag==1) grade+=0.5*score[j]; } printf("%.1f\n",grade); } int maxi=0,maxj=0; //Find the option with the most errors. If you don't understand it, you can output this matrix to compare and understand the meaning of the question for (int i=0;i<m;i++) { for (int j=0;j<5;j++) { if ( error[i][j]>error[maxi][maxj] ) { maxi=i,maxj=j; } } } if (error[maxi][maxj]==0) { printf("Too simple\n"); return 0; } for (int i=0;i<m;i++) { for (int j=0;j<5;j++) { if ( error[i][j]==error[maxi][maxj] ) printf("%d %d-%c\n",error[i][j],i+1,j+'a'); } } return 0; }