http://acm.hdu.edu.cn/showproblem.php?pid=6023
这道题唯一的坑点在于,罚时是在过了题后才加上去的,我就说这还能怎么做。
代码如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T, n, m;
bool pro[1020];
int cnt[1020];
char str[10];
int tmp, a, b;
cin >> T;
while(T--)
{
int key = 0;
int ans = 0;
memset(pro, 0, sizeof(pro));
memset(cnt, 0, sizeof(cnt));
scanf("%d%d", &n, &m);
while(m--)
{
scanf("%d %d:%d %s", &tmp, &a, &b, &str);
if(pro[tmp])
continue;
if(!strcmp(str, "AC"))
{
key++;
ans += (a * 60 + b) + cnt[tmp];
pro[tmp] = 1;
}
else
cnt[tmp] += 20;
}
cout << key << " " << ans << endl;
}
return 0;
}