求助,84分

P1104 生日

123uuu @ 2023-12-16 12:45:15

#include<bits/stdc++.h>
using namespace std;
struct xxs{
    string m;
    int n,y,r;
}tx[100+90];
bool cmp(xxs a1,xxs a2){
    if(a1.n!=a2.n)return a1.n<a2.n;
    if(a1.y!=a2.y)return a1.y<a2.y;
    if(a1.r!=a2.r)return a1.r<a2.r;
}
int main(){
    int i,n;
    cin>>n;
    for(i=1;i<=n;++i){
        cin>>tx[i].m>>tx[i].n>>tx[i].y>>tx[i].r;
    }
    sort(tx+1,tx+n+1,cmp);
    for(i=1;i<=n;++i){
        cout<<tx[i].m<<endl;
    }
return 0;
} 

by xiaoshumiao @ 2023-12-16 12:47:38

@123uuu

如果有两个同学生日相同,输入靠后的同学先输出。


by 123uuu @ 2023-12-17 11:20:33

@xiaoshumiao 谢谢,已过


|