Run ID:34280

提交时间:2022-08-02 10:43:11

#include<iostream> #include<algorithm> #include<cstring> using namespace std; struct fd{ string name; int birth; string number; }f[20]; bool cmp(fd x,fd y){ if(x.birth!=y.birth) return x.birth<y.birth; else if(x.name!=y.name) return x.name<y.name; else return x.number<y.number; } int main(){ int n; cin>>n; for(int i=0;i<n;i++) cin>>f[i].name>>f[i].birth>>f[i].number; sort(f+0,f+n,cmp); for(int i=0;i<n;i++) cout<<f[i].name<<" "<<f[i].birth<<" "<<f[i].number<<endl; return 0; }