#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef struct {
char n[6];
int y,m,d;
}people;
int No_overage(int y,int m,int d){
int tag;
if(y>2014||y<1814)
tag=0;
else if(y>1814&&y<2014)
tag=1;
else if(y==1814){
if(m<9)
tag=0;
else if(m>9)
tag=1;
else{
if(d<6)
tag=0;
else
tag=1;
}
}
else if(y==2014){
if(m<9)
tag=1;
else if(m>9)
tag=0;
else{
if(d<=6)
tag=1;
else
tag=0;
}
}
return tag;
}
bool cmp(people a,people b){
if(a.y<b.y)
return 1;
else if(a.y==b.y&&a.m<b.m)
return 1;
else if(a.y==b.y&&a.m==b.m&&a.d<b.d)
return 1;
else
return 0;
}
int main(){
int n,k=0;
cin>>n;
cin.get();
people a,max,min;
while(n--){
scanf("%s %d/%d/%d",a.n,&a.y,&a.m,&a.d);
if(No_overage(a.y,a.m,a.d)){
k++;
if(k==1){
max=a;
min=a;
} else{
if(cmp(max,a)==0)
max=a;
if(cmp(min,a)==1)
min=a;
}
}
}
if(k>=1)
cout<<k<<" "<<max.n<<" "<<min.n<<endl;
else
cout<<k<<endl;
return 0;
}
测试点3:0个合法年纪;
测试点4:不能使用数组。