概述
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
string name;
int year, month, day, count = 0;
int maxyear = 0, maxmonth = 0, maxday = 0, minyear = 9999, minmonth = 9999, minday = 9999;
string maxname, minname;
for (int i = 0; i < n; i++) {
cin >> name;
scanf("%d/%d/%d",&year, &month, &day);
if((year < 2014 || (year == 2014 && month < 9) || (year == 2014 && month == 9 && day <= 6)) &&
(year > 1814 || (year == 1814 && month > 9) || (year == 1814 && month == 9 && day >= 6))) {
count++;
if(year > maxyear || (year == maxyear && month > maxmonth) || (year == maxyear && month == maxmonth && day > maxday)) {
maxyear = year;
maxmonth = month;
maxday = day;
maxname = name;
}
if(year < minyear || (year == minyear && month < minmonth) || (year == minyear && month == minmonth && day < minday)) {
minyear = year;
minmonth = month;
minday = day;
minname = name;
}
}
}
cout << count;
if (count != 0)
cout << " " << minname << " " << maxname;
return 0;
}
最后
以上就是激昂小白菜为你收集整理的PAT basic 1028的全部内容,希望文章能够帮你解决PAT basic 1028所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复