题目链接:点击打开链接
题目大意:就不讲了,能理解的,这个题没什么难度,就是在处理输入的时候我愣了一下……
代码如下:
#include<iostream>
#include<cstdio>
#include<string.h>
using namespace std;
int vis[15],time[15];
int main()
{
int T,n,m,A,B,a,h,mi;
char str[5];
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
B=0;
memset(vis,0,sizeof(vis));
memset(time,0,sizeof(time));
for(int i=1; i<=m; i++)
{
scanf("%d %d:%d %s",&a,&h,&mi,str);
a%=1000;
if(!vis[a])
if(strcmp(str,"AC")==0)
{
vis[a]=1;
B+=h*60+mi+time[a];
}
else
{
time[a]+=20;
}
else continue;
}
A=0;
for(int i=1; i<=n; i++)
{
if(vis[i]) A++;
}
printf("%d %d\n",A,B);
}
return 0;
}
~step by step