HDU - 6023


A - Automatic Judge  

HDU - 6023 

本题题意就是设计一个类似计算ACM罚失计算的程序,用map映射把不同题号的结果,完成时间,罚时保存。最后计算即可,但是要注意,某个题必须完成,才会参与罚时计算(这是个坑)。。。

#include
#include
#include
#include
#include
#include
using namespace std;
int main(){
   maptime;
   mapans;
   mapcc;
   int T;
   int t,n,m,anss,k;
   string ti,jg,maxt;
   scanf("%d",&T);
   while (T--){
    time.clear();//清空
    ans.clear();
    cc.clear();
    anss=0;k=0;
    scanf("%d%d",&n,&m);
    for (int i=1;i<=m;i++){
        scanf("%d",&t);
        cin>>ti>>jg;

        if (ans[t]!="AC" && jg=="AC"){k++;ans[t]=jg;time[t]=ti;}//正确个数k,判题结果jg,提交时间
        else if( ans[t]!="AC" && jg!="AC") cc[t]+=20;罚失
    }
    for (int i=1001;i<=1001+n;i++){
     // printf("%d\n",cc[i]);
       if (ans[i]=="AC"){
         string s=time[i];
        anss=anss+(s[1]-'0')*60+(s[3]-'0')*10+s[4]-'0'+cc[i];//所耗时间+罚失
        }
       // printf("%d\n",anss);
    }
    printf("%d %d\n",k,anss);
    }
   return 0;
}

你可能感兴趣的:(训练赛,HDU)