#include<stdio.h>
#include<string.h>
struct peo
{
char name[7];
int year;
int mon;
int day;
}man[100010];
int main()
{
int cou=0;
char max[7];
int Max[3]={2215,9,9};
char min[7];
int Min[3]={1810,2,8};
int i;
scanf("%d",&i);
while(i-->0)
{
scanf("%s",man[i].name);
scanf("%d/%d/%d",&man[i].year,&man[i].mon,&man[i].day);
if((man[i].year>1814&&man[i].year<2014)||(man[i].year==1814&&man[i].mon>9)||(man[i].year==2014&&man[i].mon<9)||(man[i].year==1814&&man[i].mon==9&&man[i].day>=6)||(man[i].year==2014&&man[i].mon==9&&man[i].day<=6))
{
cou++;
if((Min[0]<man[i].year||(Min[0]==man[i].year&&Min[1]<man[i].mon)||(Min[0]==man[i].year&&Min[1]==man[i].mon&&Min[2]<man[i].day)))
{
strcpy(min,man[i].name);
Min[0]=man[i].year;
Min[1]=man[i].mon;
Min[2]=man[i].day;
}
if((Max[0]>man[i].year||(Max[0]==man[i].year&&Max[1]>man[i].mon)||(Max[0]==man[i].year&&Max[1]==man[i].mon&&Max[2]>man[i].day)))
{
strcpy(max,man[i].name);
Max[0]=man[i].year;
Max[1]=man[i].mon;
Max[2]=man[i].day;
}
}
}
if(cou==0) printf("0");
else
printf("%d %s %s",cou,max,min);
return 0;
}
1028 人口普查 (20 分)
最新推荐文章于 2022-07-04 10:25:18 发布