写的太乱了
#include <iostream>
#include <string.h>
using namespace std;
struct person{
char name[10];
int yy, mm, dd;
}youngest, oldest, left2, right2, temp;
bool lessEqu(person a, person b){
if(a.yy != b.yy){
return a.yy <= b.yy;
} else if(a.mm != b.mm){
return a.mm <= b.mm;
} else return a.dd <= b.dd;
}
bool moreEqu(person a, person b){
if(a.yy != b.yy){
return a.yy >= b.yy;
} else if(a.mm != b.mm){
return a.mm >= b.mm;
} else return a.dd >= b.dd;
}
void init(){
youngest.yy = right2.yy = 2014;
oldest.yy = left2.yy = 1814;
youngest.mm = right2.mm = oldest.mm = left2.mm = 9;
youngest.dd = right2.dd = oldest.dd = left2.dd = 6;
}
int main(int argc, char** argv) {
init();
int n, num = 0;
cin >> n;
while(n--){
scanf("%s %d/%d/%d", temp.name, &temp.yy, &temp.mm, &temp.dd);
//cout << lessEqu(temp, right2) << " " << moreEqu(temp, left2) << endl;
if(lessEqu(temp, right2) && moreEqu(temp, left2)){
num++;
//cout << temp.name << endl;
if(lessEqu(temp, youngest)){
youngest = temp;
}
if(moreEqu(temp, oldest)){
oldest = temp;
}
}
}
if(num == 0){
printf("0\n");
} else {
cout << num << " " << youngest.name << " " << oldest.name;
}
return 0;
}