0
已解决
丁浩然
新手光能
新手光能
很紧急,请找错
#include <bits/stdc++.h>
using namespace std;
struct node
{
string name;
int year,month,day,flag;
} a[105];
bool cmp(node a,node b)
{
if (a.year==b.year)
{
if (a.month==b.month)
{
if (a.day==b.day)
return a.flag<b.flag;
else return a.day<b.day;
}
else return a.month<b.month;
}
else return a.year>b.year;
}
int main()
{
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
cin>>a[i].name>>a[i].year>>a[i].month>>a[i].day;
a[i].flag=i;
}
sort(a+1,a+n+1,cmp);
for(int i=1; i<=n; i++)
cout<<a[i].name<<endl;
return 0;
}