P1104
#include<iostream>
#include<algorithm>
using namespace std;
struct student{
int yeah,month,day,num;
string s;
}stu[110];
bool cmp(student a,student b)
{
if(a.yeah<b.yeah)
{
return 1;
}
if(a.yeah>b.yeah)
{
return 0;
}
if(a.yeah==b.yeah)
{
if(a.month<b.month)
{
return 1;
}
if(a.month>b.month)
{
return 0;
}
if(a.month==b.month)
{
if(a.day<b.day)
{
return 1;
}
if(a.day>b.day)
{
return 0;
}
if(a.day==b.day)
{
if(a.num<b.num)
{
return 1;
}
else
{
return 0;
}
}
}
}
}
int main()
{
int a;
cin>>a;
for(int i=1;i<=a;i++)
{
cin>>stu[i].s>>stu[i].yeah>>stu[i].month>>stu[i].day;
stu[i].num=i;
}
stable_sort(stu+1,stu+a+1,cmp);
for(int i=1;i<=a;i++)
{
cout<<stu[i].s<<endl;
}
return 0;
}
后两点wa了,也不知道有什么地方错了,请各位dalao纠正