Time Limit: 2000/1000 ms (Java/other) memory limit: 65536/32768 K (Java/other) total submission (s): 1 accepted submission (s): 1 Font: times New Roman | verdana | georgiafont size: Drawing → Problem description the first person to the data center opens the door every day, and the last person to leave the door 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 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
#include<stdio.h>#include<string.h>struct st{ char zhengjian[20]; char kaishi[10]; char jieshu[10];}data[100];int main(){ int T,n,i,j; struct st data[100],t; scanf("%d",&T); while(T--) { scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s %s %s",data[i].zhengjian,data[i].kaishi,data[i].jieshu); } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) if(strcmp(data[i].kaishi,data[j].kaishi)>0) { t=data[i]; data[i]=data[j]; data[j]=t; } } printf("%s ",data[0].zhengjian); for(i=0;i<n;i++) { for(j=i+1;j<n;j++) if(strcmp(data[i].jieshu,data[j].jieshu)<0) { t=data[i]; data[i]=data[j]; data[j]=t; } } printf("%s\n",data[0].zhengjian); } return 0;}
Opening and Closing persons (Hangzhou 1234)