HDU 1234 opens and closes the door

Source: Internet
Author: User
Tags number sign
HDU 1234 opens the door and the closing person Problem description every day the first person to the IDC should open the door, and the last person to leave should close the door. There are a bunch of messy data center signatures
Identify the person who opens or closes the door on the day according to the record.

 

The first line of input in the input test shows the total number of days of the record N (> 0 ). The records for N days are listed below.
The number of records per day m (> 0) is given in the first line. below is m, and the format of each row is

Credential number sign-in time sign-out time

The time is given by hour: minute: Second (two digits each). The document number is a string of no more than 15 characters.
 

 

Output outputs one line of records for each day, that is, the ID number of the person who opens the door and closes the door on the same day, separated by a space in the middle.
Note: In the standard test input of the referee, all records must be complete. The check-in time of each person must be before the signing time,
No one signs in or signs out at the same time.
 

 

Sample input31 me3021112225321 00:00:00 23: 59: 592ee301218 08:05:35 ma301134 20:56:35 21: 40: 423cs301111 12:35:45 17: 00: 10sc3021234 15:30:28 cs301133 08:00:00 11:25:25

 

Sample outputme3021112225321 me3021112225321 ee301218 ma301134sc3021234 cs301133

ACCodeAs follows:

# Include <iostream>
Using namespace STD;
Struct
{
Char ZJ [20], St [20], et [20];
} TMD [2, 1000];
Int main ()
{
Int T, I, n, Min, Max;
Char mint [20], maxt [20];
Scanf ("% d", & T );
While (t --)
{
Scanf ("% d \ n", & N );
Scanf ("% S % s \ n", TMD [1]. ZJ, TMD [1]. St, TMD [1]. Et );
Strcpy (mint, TMD [1]. St );
Min = 1;
Strcpy (maxt, TMD [1]. Et );
Max = 1;
For (I = 2; I <= N; I ++)
{
Scanf ("% S % s", TMD [I]. ZJ, TMD [I]. St, TMD [I]. Et );
If (strcmp (mint, TMD [I]. St)> 0)
{
Strcpy (mint, TMD [I]. St );
Min = I;
}
If (strcmp (maxt, TMD [I]. Et) <0)
{
Strcpy (maxt, TMD [I]. Et );
Max = I;
}
}
Printf ("% S % s \ n", TMD [Min]. ZJ, TMD [Max]. zj );
}
Return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.