九度1013 开门人和关门人
/********************************* * 日期:2012-6-29 * 作者:SJF0115 * 题号: 九度1013 * 题目:开门人和关门人 * 结果:AC * 题意: * 总结:**********************************/#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){int N,M;//输入重定向,输入数据将从in.txt文件中读取//freopen("C:\\Users\\SJF\\Desktop\\in.txt","r",stdin); while(scanf("%d",&N)!=EOF) { int i,j;int in = 0,out = 0;int hour,minute,second,inTime[100],outTime[100];char ID[100][100];for(i = 0;i<N;i++){scanf("%d",&M);for(j = 0;j<M;j++){scanf("%s %d:%d:%d",&ID[j],&hour,&minute,&second);inTime[j] = hour*3600 + minute*60 + second;if(inTime[j] < inTime[in]){in = j;}scanf("%d:%d:%d",&hour,&minute,&second);outTime[j] = hour*3600 + minute*60 + second;if(outTime[j] > outTime[out]){out = j;}}printf("%s %s\n",ID[in],ID[out]);} } return 0;}