#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef struct{
string name;
string bir;
}people;
bool cmp(people s)
{
string sx="2014/09/06";
string xx="1814/09/06";
if(s.bir>=xx && s.bir<=sx)
return true;
return false;
}
struct rule1{
bool operator()(const people &p1,const people &p2) const{
return p1.bir<p2.bir;
}
};
int main()
{
int n;
cin>>n;
vector<people> v;
people old,young;
for(int i=0;i<n;i++)
{
people x;
cin>>x.name>>x.bir;
if(cmp(x))
v.push_back(x);
}
if(v.size()!=0)
{
cout<<v.size()<<" ";
sort(v.begin(),v.end(),rule1());
cout<<v.begin()->name<<" "<<(v.end()-1)->name;
}
else
cout<<v.size();
return 0;
}
PAT乙级 1028 人口普查
最新推荐文章于 2023-10-03 15:48:08 发布