1073. Common scoring method for multiple-choice questions (20)

1073. Common scoring method for multiple-choice questions (20)

time limit
400 ms
memory limit
65536 kB
code length limit
8000 B
Judgment procedure
Standard
author
CHEN, Yue

Correcting multiple-choice questions is a bit of a hassle, and there are many different scoring methods. One of the most common scoring methods is that if the candidate selects some of the correct options and no incorrect options are selected, 50% is awarded; if the candidate selects any of the incorrect options, no points are awarded. For this question, please write a program to help teachers mark multiple-choice questions, and point out which question has the most wrong choices.

Input format:

The input gives two positive integers N (<=1000) and M (<=100) in the first line, which are the number of students and the number of multiple-choice questions, respectively. Then M lines, each line gives 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 exceeding 5), and the number of correct options (not more than 5 options) positive integer number), all correct options. Note that the options for each question are arranged in order starting with the lowercase English letter a. Each item is separated by 1 space. The last N lines, each line gives a student's answer, the answer format of each question is "(the number of selected options option 1...)", given in the order of the questions. Note: The question guarantees that the students' answers are legal, that is, there is no situation where the number of selected options exceeds the actual number of options.

Output format:

Give each student's score in the order of input, each score on a line, and output 1 decimal place. Finally, output the information of the question option with the most errors, in the format: "error number question number (the questions are numbered from 1 in the order of input) - option number". If there is a tie, there will be one option per line, and it will be output in the ascending order of the item number; if it is juxtaposed, it will be output in the increasing order of the option number. There must be no extra spaces at the beginning and end of the line. If all questions are correct, output "Too simple" on the last line.

Input sample 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)
Sample output 1:
3.5
6.0
2.5
2 2-e
2 3-a
2 3-b
Input sample 2:
2 2
3 4 2 a c
2 5 1 b
(2 a c) (1 b)
(2 a c) (1 b)
Sample output 2:
5.0
5.0
Too simple

The general idea is similar to the previous "multiple choice question", except that some judgments are more confusing.


#include<stdio.h>
#include<iostream>
using namespace std;
struct node{
    double full;
    int num;
    int right;
    string daan;
    int h[6]={0};
}ti[101];
int main(){
    int n,m,k;
    string a;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++){
        cin>>ti[i].full>>ti[i].num>>ti[i].right;
        for(int j=0;j<ti[i].right;j++){
            cin>>a;
            ti[i].daan+=a;
        }
    }

    double sum;
    for(int i=0;i<n;i++){
    sum=0.0;
      for(int t=0;t<m;t++){scanf("\n");
        string pr;char ss;int f=0;string shan;shan=ti[t].daan;
        scanf("(%d",&k);
        for(int j=0;j<k;j++){
            scanf(" %c",&ss);
            if(ti[t].daan.find(ss)==string::npos){
                f=1;
                ti[t].h[ss-'a']++;
    //            cout<<t<<" "<<ss<<"222"<<endl;
//                printf("*");
            }else{
                shan.erase(shan.begin()+shan.find(ss));
     //                       cout<<shan<<"*"<<endl;
            }
            pr+=ss;

        }
       // cout<<pr<<endl;
        if(t<m-1){
            scanf(") ");
        }else{scanf(")");}
        if(f==0){
            if(ti[t].daan==pr){
                sum=sum+ti[t].full;
            }else{sum=sum+(double)(ti[t].full/2);
            int l=shan.length();

            for(int ii=0;ii<l;ii++){
          //      cout<<t<<" "<<shan[ii]<<"111"<<endl;
                ti[t].h[shan[ii]-'a']++;
            }
  //cout<<t<<" "<<sum<<endl;
            }
        }else{
            int l=shan.length();

            for(int ii=0;ii<l;ii++){
      //          cout<<t<<" "<<shan[ii]<<"111"<<endl;
                ti[t].h[shan[ii]-'a']++;
            }
        }
      }
      printf("%.1lf\n",sum);
    }
    int max=0;
    for(int i=0;i<m;i++){
        for(int j=0;j<6;j++){
            if(ti[i].h[j]>max){
                max=ti[i].h[j];
            }
        }
    }
    if(max!=0){
    for(int i=0;i<m;i++){
        for(int j=0;j<6;j++){
            if(ti[i].h[j]==max){
                char aa='a'+j;
                cout<<ti[i].h[j]<<" "<<i+1<<"-"<<aa<<endl;
            }
        }
    }
    }else{cout<<"Too simple"<<endl;}
}


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324778874&siteId=291194637