PATB1028.人口普查(20)

题目链接:点击打开链接

知识点笔记:

 1.注意比较方法的使用

 2.最后需要判空输出


AC代码:

#include 

struct person{
	char name[10];
	int y,m,d;
}youngest,oldest,left,right,temp;


bool lessEqu(person a,person b){
	if(a.y!=b.y) return a.y<=b.y;
	else if(a.m!=b.m) return a.m<=b.m;
	else  return a.d<=b.d;
}


void init(){
	right.y = oldest.y=2014;
	left.y = youngest.y = 1814;
	right.m=left.m=oldest.m=youngest.m=9;
	right.d=left.d=oldest.d=youngest.d=6;
}
int main() {

	int n;
	int count=0;
	scanf("%d",&n);
	init();
	for(int i=0;i

你可能感兴趣的:(PATB)