1058

PAT_B_1058

#include<stdio.h>
#include<string.h>
typedef struct question_ans
{
    int score, sum, t;
    char ans[10];
    int counter;
}ANS;
int Is_Judge(char a[], char b[], int c)
{
    int i = 1;
    while (i<=c)
    {
        if (!(a[i] == b[i]))
            return 0;
        i++;
    }
    return 1;
}
int main()
{
    int n, m, i, j, a,t,maxc=0;
    ANS A[110];
    int student[1100];
    char ans[10];
    scanf("%d%d", &n, &m);
    for (i = 1; i <= m; i++)
    {
        scanf("%d%d%d", &A[i].score, &A[i].sum, &A[i].t);
        for (j = 1; j <= A[i].t; j++)
        {
            getchar();//
            scanf("%c", &A[i].ans[j]);
        }
        A[i].counter = 0;
    }
    for (i = 1; i <= n; i++)
    {
        student[i] = 0;
        for (j = 1; j <= m; j++)
        {
            t = 1;
            getchar();//
            scanf("(%d", &a);
            while (t<=a)
            {

                getchar();//
                scanf("%c", &ans[t]);
                t++;
            }

            //ans[t] = '\0';
            //printf("ans=%s\n", ans+1);

            scanf(")");

            if (a == A[j].t&&Is_Judge(ans, A[j].ans, a))
            {
                student[i] += A[j].score;
            }
            else
                A[j].counter++;

            if (A[j].counter > maxc)
            {
                maxc = A[j].counter;
            }

        }
    }
    for (i = 1; i <= n; i++)
    {
        printf("%d\n", student[i]);
    }
    if (maxc == 0)
        printf("Too simple\n");
    else
    {
        printf("%d", maxc);
        for (i = 1; i <= m; i++)
        {
            if (A[i].counter == maxc)
                printf(" %d", i);
        }
        printf("\n");
    }

    system("pause");
    return 0;
}

猜你喜欢

转载自blog.csdn.net/zero_1778393206/article/details/79333669
今日推荐