-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL1-043 阅览室.cpp
More file actions
58 lines (56 loc) · 1.15 KB
/
L1-043 阅览室.cpp
File metadata and controls
58 lines (56 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
const int SIZE = 1005;
struct node{
int ks;
int sj;
node(){ks = -1, sj = -1;}
} arr[SIZE];
int main(int argc, const char *argv[])
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int Days, daysjl = 0;
int temp;
int num = 0, time = 0;
scanf("%d", &Days);
while(scanf("%d", &temp) != EOF) {
getchar();
char zt;
int hh, mm;
zt = getchar();
scanf("%d:%d", &hh, &mm);
if(temp == 0) {
daysjl++;
if(num != 0) printf("%d %d\n", num, (int)(time*1.0/num+0.5));
else printf("0 0\n");
num = time = 0;
memset(arr, -1, sizeof(arr));
}
if(daysjl == Days) break;
if(temp == 0) continue;
if(zt == 'S') {
arr[temp].ks = hh*60+mm;
} else {
if(arr[temp].ks != -1 || arr[temp].sj != -1) {
num++;
arr[temp].sj = hh*60+mm-arr[temp].ks;
//printf("%d %d\n", hh*60+mm, arr[temp].ks);
time+=arr[temp].sj;
arr[temp].ks = arr[temp].sj = -1;
}
}
}
return 0;
}