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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值