当前位置: 代码迷 >> 综合 >> 1028 人口普查 (20 分)
  详细解决方案

1028 人口普查 (20 分)

热度:87   发布时间:2023-12-05 07:10:28.0

1028 人口普查 (20 分)

#include <iostream>
using namespace std;
int main() 
{int n, cnt = 0;cin >> n;string name, birth, maxname, minname;string maxbirth = "1814/09/06", minbirth = "2014/09/06";for (int i = 0; i < n; i++) {cin >> name >> birth;if (birth >= "1814/09/06" && birth <= "2014/09/06"){cnt++;if (birth >= maxbirth){maxbirth = birth;maxname = name;}if (birth <= minbirth) {minbirth = birth;minname = name;}}}cout << cnt;if (cnt != 0) cout << " " << minname << " " << maxname;return 0;
}