题目意思不难理解,但为什么不能把分拿满,可能是个人想的太复杂
#include<stdio.h>
#include<map>
using namespace std;
int main(){
int n;
scanf("%d",&n);
while(n--){
int ans = 0, num = 0;
pair<int,int> S[1005];
for(int i=0;i<1000;i++) S[i].first = -1;
for(int i=0;;i++){
int a,c,d;
char b;
scanf("%d %c %d:%d",&a,&b,&c,&d);
if(a == 0) break;
if(b == 'S') {
S[a].first = c;
S[a].second = d;
}
else {
if(S[a].first == -1) continue;
num ++;
ans += (c - S[a].first)*60;
ans += (d - S[a].second);
S[a].first = -1;
}
}
if(num == 0) printf("0 0\n");
else printf("%d %.0f\n",num,(double)ans/num);
}
return 0;
}