#include <stdio.h>
#include <string.h>
int early,late,n;
char earlyP[20],lateP[20];
int time(int hh,int mm,int ss){
int ans=hh*60*60+mm*60+ss;
return ans;
}
int main(){
//freopen("/Users/pantingting/Documents/code/data/input", "r", stdin);
early=123123123;
late=0;
scanf("%d",&n);
char tmp[20];
int hh,mm,ss;
int t;
for (int i=0; i<n; i++) {
scanf("%s",tmp);
scanf("%d:%d:%d",&hh,&mm,&ss);
t=time(hh, mm, ss);
if (t<early) {
strcpy(earlyP,tmp);
early=t;
}
scanf("%d:%d:%d",&hh,&mm,&ss);
t=time(hh, mm, ss);
if (t>late) {
strcpy(lateP,tmp);
late=t;
}
}
printf("%s %s\n",earlyP,lateP);
return 0;
}
PAT 1006. Sign In and Sign Out (25)
最新推荐文章于 2021-02-24 14:33:32 发布