_zhiqi_ @ 2023-07-09 16:14:20
#include<bits/stdc++.h>
using namespace std;
struct st{
string nm;
int n,y,r;
int nl;
} a[200];
int n;
int i;
int cmp(st a,st b)
{
return a.nl<b.nl;
}
int main()
{
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a[i].nm>>a[i].n>>a[i].y>>a[i].r;
a[i].nl=a[i].n*365+a[i].y*30+a[i].r;
}
sort(a+1,a+i+1,cmp);
for(int j=2;j<=i;j++)
{
cout<<a[j].nm<<endl;
}
return 0;
}
by Liyiyang1123 @ 2023-07-23 19:22:36
不光有
建议使用结构体排序。
bool cmp(student x,student y){
if(x.y==y.y){
if(x.m==y.m){
if(x.d==y.d) return x.ref>y.ref;
else return x.d<y.d;
}
else return x.m<y.m;
}
else return x.y<y.y;
}
by _zhiqi_ @ 2024-05-04 13:47:46
@Liyiyang1123 谢谢大佬指教