女赛--Automatic Judge

题意,给出题号,提交时间,提交结果,输出A题量和罚时
思路:简单清晰的水题,直接统计,建个数组存存状态就好,注意了不能重复AC同一个题就可以了

代码:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;
#define INF 0x3f3f3f3f;
int a,b,x,y,n,t,m,look[1050],pos[1050],ans,num;
char ch[10];
string s;
int main()
{
    cin>>t;
    while(t--)
    {
        ans=0;num=0;
        scanf("%d%d",&n,&m);
        memset(look,0,sizeof(look));
        memset(pos,0,sizeof(pos));
        while(m--)
        {
            scanf("%d %d:%d %s",&x,&a,&b,ch);
            s=ch;
            if(s=="AC")
            {
                if(look[x]==0)
                {
                    ans+=a*60+b+pos[x];
                    num++;
                    look[x]=1;
                }
            }
            else
            {
                pos[x]+=20;
            }
        }
        printf("%d %d\n",num,ans);
    }
}

猜你喜欢

转载自blog.csdn.net/qq_37868325/article/details/80275184