#include<stdio.h>
typedef struct townPerson
{
char name[10];
long long age;
int year;
int month;
int day;
int Legal;
}Person;
int main()
{
int N;
scanf("%d", &N);
Person person[100010];
int i, j=0, maxAge=0, minAgeNum=0, legalNum=0;
long long minAge=20140906, maxAgeNum=18140906;
char c;
for(i=0;i<N;i++)
{
scanf("%s", &person[i].name[j]);
scanf("%d%c%d%c%d", &person[i].year, &c, &person[i].month, &c, &person[i].day);
person[i].age = person[i].year*10000 + person[i].month*100 + person[i].day;
if(person[i].age>20140906 || person[i].age<18140906)
person[i].Legal = 0;
else
person[i].Legal = 1;
if(person[i].Legal == 1)
{
legalNum++;
if(minAge>person[i].age)
{
minAge = person[i].age;
minAgeNum = i;
}
if(maxAge<person[i].age)
{
maxAge = person[i].age;
maxAgeNum = i;
}
}
}
printf("%d", legalNum);
if(legalNum)
{
printf(" %s ", person[minAgeNum].name);
printf("%s", person[maxAgeNum].name);
}
}
网友评论