80分,最后一个WA
  • 板块P1104 生日
  • 楼主lanbing_e
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/7/22 10:59
  • 上次更新2024/7/22 11:47:49
查看原帖
80分,最后一个WA
1386335
lanbing_e楼主2024/7/22 10:59
#include<bits/stdc++.h>
using namespace std;
struct node{
	string name;
	int year,mouth,day;
};
int n;
node stu[101];
bool cmp(node x,node y)
{
	if(x.year!=y.year) return x.year<y.year;
	else if(x.mouth!=y.mouth) return x.mouth<y.mouth;
	else return x.day<y.day;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>stu[i].name>>stu[i].year>>stu[i].mouth>>stu[i].day;
	}
	sort(stu,stu+n,cmp);
	for(int i=0;i<n;i++)
	{
		cout<<stu[i].name<<endl;
	}
	return 0;
}

最后一个WA了,咋做啊!

2024/7/22 10:59
加载中...