有点难,但是还好
2025-12-28 14:29:10
发布于:广东
4阅读
0回复
0点赞
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;
struct node{
string name;
ll year;
short month,day;
};
bool cmp(node x,node y){
if(x.year == y.year){
if(x.month == y.month){
if(x.day == y.day)return x.name > y.name;
else return x.day < y.day;
}
else return x.month < y.month;
}
else return x.year < y.year;
}
int main()
{
ll n;
cin >> n;
const ll szc = n+10;
node people[szc];
for(ll i = 0;i < n;i++)cin >> people[i].name >> people[i].year >> people[i].month >> people[i].day;
sort(people,people+n,cmp);
for(ll i = 0;i < n;i++)cout << people[i].name << endl;
return 0;
}
这里空空如也







有帮助,赞一个