PAT1073 Multiple-choice questions common scoring method (20 points)

坑点:

  • See the title, is the most wrong option, not the most wrong option in the most wrong
  • 50% of the kind of question, not wrong
  • The correct option was not selected, that option is also wrong, in the wrong question
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

struct St
{
    int fs,gs,id;
    bool p[5] = {false};
    int nu[5] = {0};
    int ma;
} pr[105];

bool cmp(struct St a, struct St b)
{
    if(a.ma == b.ma)
        return a.id < b.id;
    return a.ma > b.ma;
}

void solve()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++)
    {
        int x;
        scanf("%d%d%d", &pr[i].fs, &x, &pr[i].gs);
        for(int j = 0; j < pr[i].gs; j++)
        {
            char y;
            scanf(" %c", &y);
            pr[i].p[y - 'a'] = true;
        }
        pr[i].id = i + 1;
        pr[i].ma = 0;
    }
    while(n--)
    {
        double re = 0;
        for(int i = 0; i < m; i++)
        {
            char y;
            scanf(" %c", &y);
            int h;
            scanf("%d", &h);
            bool fa = true;
            bool ss[5] = {false};
            for(int j = 0; j < h; j++)
            {
                scanf(" %c", &y);
                if(!pr[i].p[y - 'a'])
                    fa = false;
                ss[y - 'a'] = true;
            }
            scanf("%c", &y);
            if(h != pr[i].gs && fa)
            {
                re += pr[i].fs * 1.0 / 2;
                fa = false;
            }
            if(!fa)
            {
                for(int j = 0; j < 5; j++)
                    if(pr[i].p[j] != ss[j]){
                        pr[i].nu[j]++;
                        pr[i].ma = max(pr[i].ma, pr[i].nu[j]);
                    }
            }
            else
                re += pr[i].fs;

        }
         printf("%.1f\n", re);
    }
    sort(pr, pr + m, cmp);
    int maa = pr[0].ma;
    if(maa == 0)
        printf("Too simple\n");
    else
    {
        for(int i = 0; i < m; i++)
        {
            if(maa != pr[i].ma)
                break;
            for(int j = 0; j < 5; j++)
            {
                char x = j + 'a';
                if(pr[i].nu[j] == maa)
                    printf("%d %d-%c\n", maa, pr[i].id, x);

            }

        }
    }
    return;
}

int main()
{
    solve();
    return 0;
}

                20分中题, a bit like 1058, increase the error of each option An array of times, the data structure will replace the wrong topic with the wrong number of options.

2018年1717 17:19:52