Door opener and closing man
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 11372 Accepted Submission (s): 5786
Problem description The first person to the computer room every day to open the door, the last one to leave the door closed. A mess of the existing room
To and from the record, please find out the person who opened and closed the door according to the records.
The first line of input test inputs gives the total number of days of records N (> 0). The following is a list of N-Day records.
Each day the record in the first row gives the number of entries in the record m (> 0), the following is the M row, each line is formatted as
Passport number check-in time sign-off time
The time is given by "hours: minutes: Seconds" (2 bits each), and the ID number is a string of no more than 15 length.
Output 1 lines for each day's record, that is, the opening and closing of the person's identification number, in the middle with 1 spaces separated.
Note: In the referee's standard test input, all records are guaranteed to be complete and each person's check-in time is before the checkout time.
And no more people sign in or sign out at the same time.
Sample Input
31me3021112225321 00:00:00 23:59:592ee301218 08:05:35 20:56:35ma301134 12:35:45 21:40:423cs301111 15:30:28 17:00:10sc3021234 08:00:00 11:25:25cs301133 21:45:00 21:58:40
Sample Output
ME3021112225321 me3021112225321ee301218 ma301134sc3021234 CS301133
SOURCE Zhejiang University Computer Postgraduate exam on the machine-2005
Record the first one, and then compare them to find the earliest and the latest.
#include <stdio.h>typedef Struct{char name[225]; Char Qiandao[225];char likai[225];} Record; #include <string.h> #include <algorithm>using namespace Std;int main () {int n,m;scanf ("%d", &n); while (n--) {record r,l,k;scanf ("%d", &m), scanf ("%s%s%s", R.name,r.qiandao,r.likai); l=r; Record k=r; Record while (--m) {scanf ("%s%s%s", R.name,r.qiandao,r.likai), if (strcmp (R.qiandao,l.qiandao) <0) l=r; Find out the earliest if (strcmp (R.likai,k.likai) >0) k=r;//Find the latest}printf ("%s%s\n", l.name,k.name);//output. }return 0;}
HDU 1234 The door man and the closing man.