1006

来源:互联网 发布:Java开发dwg批量转jpg 编辑:程序博客网 时间:2024/06/05 22:48
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;


int main1006(){
int M;
cin >> M;


char id1[20];
char id2[20];
int earliest = 24 * 3600 + 24 * 60 + 60;
int lastest = 0;
for (int i = 0; i < M; i++){
char str[20];
int h1, h2, m1, m2, s1, s2;
scanf("%s %d:%d:%d %d:%d:%d", &str, &h1, &m1, &s1, &h2, &m2, &s2);


int time1 = h1 * 3600 + m1 * 60 + s1;
int time2 = h2 * 3600 + m2 * 60 + s2;
if (time1 < earliest){
earliest = time1;
strcpy(id1, str);
}
if (time2 > lastest){
lastest = time2;
strcpy(id2, str);
}
}


printf("%s %s", id1, id2);
return 0;
}
0 0