题目描述
简单模拟,取个最大最小值就完事了。
C++ 代码
#include <iostream>
using namespace std;
const int N = 15;
struct S
{
string id, t1, t2;
}s[N];
int n;
int main()
{
cin >> n;
for (int i = 0; i < n; i ++) cin >> s[i].id >> s[i].t1 >> s[i].t2;
string imin, imax, tmin = "9999999999", tmax = "0";
for (int i = 0; i < n; i ++)
{
if (s[i].t1 < tmin)
tmin = s[i].t1, imin = s[i].id;
if (s[i].t2 > tmax)
tmax = s[i].t2, imax = s[i].id;
}
cout << imin << " " << imax;
}