1028 人口普查(20 分)

#include
#include
#include
using namespace std;
const int maxn = 1e5 + 10;
struct pep {
    string name, bir;
}a,young,old;
int n, cnt;
string up = "2014/09/06", down = "1814/09/06";
int main()
{
    scanf("%d", &n);
    young.bir = down;
    old.bir = up;
    while (n--)
    {
        cin >> a.name >> a.bir;
        if (!(a.bir >= down&&a.bir <= up))continue;
        cnt++;
        if (a.bir > young.bir)young = a;
        if (a.bir < old.bir)old = a;
    }
    if(cnt)cout << cnt << " " << old.name << " " << young.name;
    else cout << cnt;
    return 0;
}

你可能感兴趣的:(1028 人口普查(20 分))